一个pod启动多个container

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.24.0 (7c629530)
  creationTimestamp: null
  labels:
    io.kompose.service: web
  name: web
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: web
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert
        kompose.version: 1.24.0 (7c629530)
      creationTimestamp: null
      labels:
        io.kompose.service: web
    spec:
      containers:
        - command:
            - /bin/sh
            - /code/package/start.sh
          image: seasonzhang/gaga_meeting:0.9.7
          imagePullPolicy: IfNotPresent
          name: gaga-meeting-web
          ports:
            - containerPort: 8000
          resources:
            requests:
              cpu: 500m
              memory: 500Mi
            limits:
              cpu: 500m
              memory: 500Mi
#           volumeMounts:
#             - mountPath: /code/package/GAGA/SQL
#               name: C
#       restartPolicy: Always
#       volumes:
#         - name: C
#           persistentVolumeClaim:
#             claimName: C
# status: {}
        - image: redis:alpine
          name: gaga-meeting-redis
          ports:
            - containerPort: 6379
          resources:
            requests:
              cpu: 200m
              memory: 200Mi
            limits:
              cpu: 200m
              memory: 200Mi
        - command:
            - /bin/sh
            - /code/package/start-flower.sh
          image: seasonzhang/gaga_meeting:0.9.7
          name: gaga-meeting-flower
          ports:
            - containerPort: 5555
          resources:
            requests:
              cpu: 100m
              memory: 100Mi
            limits:
              cpu: 200m
              memory: 200Mi
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.24.0 (7c629530)
  creationTimestamp: null
  labels:
    io.kompose.service: web
  name: web
spec:
  type: LoadBalancer
  ports:
    - name: "8000"
      port: 8000
      targetPort: 8000
      rotocol: TCP
  selector:
    io.kompose.service: web
status:
  loadBalancer: {}

---

apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.24.0 (7c629530)
  creationTimestamp: null
  labels:
    io.kompose.service: redis
  name: redis
spec:
  type: LoadBalancer
  ports:
    - name: "6379"
      port: 6379
      targetPort: 6379
  selector:
    io.kompose.service: redis
status:
  loadBalancer: {}

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐