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