k8s 常用yml

1、pvc

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nmg-logs
  namespace: nmg-test
spec:
  storageClassName: "glusterfs"
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi

2、跑jar包

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: seewin-gateway
  namespace: nmg-test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: seewin-gateway
  template:
    metadata:
      labels:
        app: seewin-gateway
      annotations:
        sidecar.istio.io/rewriteAppHTTPProbers: "false"
    spec:
      containers:
        - name: seewin-gateway
          image: 192.168.31.15/nmg-test/seewin-gateway:latest
          imagePullPolicy: Always
          ports:
            - name: http-port-1
              containerPort: 9000
              protocol: TCP
          volumeMounts:
            - name: nmg-logs
              mountPath: "/app/logs"
      volumes:
        - name: nmg-logs
          persistentVolumeClaim:
            claimName: nmg-logs
---
apiVersion: v1
kind: Service
metadata:
  name: seewin-gateway
  namespace: nmg-test
spec:
  type: NodePort
  sessionAffinity: None
  selector:
    app: seewin-gateway
  ports:
    - name: http-port-1
      protocol: TCP
      port: 9000
      targetPort: 9000
      nodePort: 30090

 

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ibuilds-consumer-adm-system
  namespace: nmg-test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ibuilds-consumer-adm-system
  template:
    metadata:
      labels:
        app: ibuilds-consumer-adm-system
      annotations:
        sidecar.istio.io/rewriteAppHTTPProbers: "false"
    spec:
      containers:
        - name: ibuilds-consumer-adm-system
          image: 192.168.31.15/nmg-test/ibuilds-consumer-adm-system:latest
          imagePullPolicy: Always
          ports:
            - name: http-port-1
              containerPort: 9091
              protocol: TCP
          volumeMounts:
            - name: nmg-logs
              mountPath: "/app/logs"
      volumes:
        - name: nmg-logs
          persistentVolumeClaim:
            claimName: nmg-logs
---
apiVersion: v1
kind: Service
metadata:
  name: ibuilds-consumer-adm-system
  namespace: nmg-test
spec:
  type: ClusterIP
  sessionAffinity: None
  selector:
    app: ibuilds-consumer-adm-system
  ports:
    - name: http-port-1
      protocol: TCP
      port: 9091
      targetPort: 9091

 

posted @ 2024-10-30 17:04  苦逼yw  阅读(5)  评论(0编辑  收藏  举报