deployment Yaml中args與command字段


使用示例

1. 使用args參數
metadata:
  name: busybox-test
  namespace: dj
  selfLink: /apis/apps/v1/namespaces/dj/deployments/busybox-test
  uid: a4bab801-2ee2-11eb-b1e4-0050568eb6f2
  resourceVersion: '2380893'
  generation: 12
  creationTimestamp: '2020-11-25T05:54:12Z'
  labels:
    dj-app: busybox-test
    version: v1
  annotations:
    deployment.kubernetes.io/revision: '10'
spec:
  replicas: 1
  selector:
    matchLabels:
      dj-app: busybox-test
      version: v1
  template:
    metadata:
      creationTimestamp: null
      labels:
        dj-app: busybox-test
        version: v1
    spec:
      containers:
        - name: busybox-test
          image: 'registry.cluster.local:30443/amd64/busybox:1.31.1'
          args:
            - /bin/sh
            - '-c'
            - sleep 3600
          ports:
            - containerPort: 80
              protocol: TCP
          envFrom:
            - configMapRef:
                name: default
                optional: true
            - configMapRef:
                name: busybox-test
          resources:
            limits:
              cpu: 250m
              memory: 500M
            requests:
              cpu: 250m
              memory: 500M
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 600
2. 使用command
metadata:
  name: busybox-test
  namespace: dj
  selfLink: /apis/apps/v1/namespaces/dj/deployments/busybox-test
  uid: a4bab801-2ee2-11eb-b1e4-0050568eb6f2
  resourceVersion: '2380893'
  generation: 12
  creationTimestamp: '2020-11-25T05:54:12Z'
  labels:
    dj-app: busybox-test
    version: v1
  annotations:
    deployment.kubernetes.io/revision: '10'
spec:
  replicas: 1
  selector:
    matchLabels:
      dj-app: busybox-test
      version: v1
  template:
    metadata:
      creationTimestamp: null
      labels:
        dj-app: busybox-test
        version: v1
    spec:
      containers:
        - name: busybox-test
          image: 'registry.cluster.local:30443/amd64/busybox:1.31.1'
          command: [ "/bin/sh","-c","sleep 3600" ]    #啟動命令
          ports:
            - containerPort: 80
              protocol: TCP
          envFrom:
            - configMapRef:
                name: default
                optional: true
            - configMapRef:
                name: busybox-test
          resources:
            limits:
              cpu: 250m
              memory: 500M
            requests:
              cpu: 250m
              memory: 500M
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 600
3. 說明


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM