【k8s】deploy-progressDeadlineSeconds


環境

  1. kubernetes 1.20.4
  2. Spring Boot 2.5.0-M3

目標

deploy 升級過程中的最大時間由 progressDeadlineSeconds 來定義。
如果升級過程被暫停了,該時間也會同步暫停,時間不會一直增長。

示例

Deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: busybox
spec:
  progressDeadlineSeconds: 3
  selector:
    matchLabels:
      app: busybox
  replicas: 18
  template:
    metadata:
      labels:
        app: busybox
    spec:
      terminationGracePeriodSeconds: 5
      containers:
        - name: busybox
          image: busybox:1.30.0
          command: ["/bin/sh", "-c", "sleep 3600"]

查看

[root@master ~]# kubectl get pod
NAME                       READY   STATUS              RESTARTS   AGE
busybox-6bd65c67cf-2lq2x   0/1     ContainerCreating   0          35s
busybox-6bd65c67cf-44j46   1/1     Running             0          35s
busybox-6bd65c67cf-4hchv   0/1     ContainerCreating   0          35s
busybox-6bd65c67cf-bll7f   1/1     Running             0          35s
busybox-6bd65c67cf-hm7n7   0/1     ContainerCreating   0          35s
busybox-6bd65c67cf-jd7w9   0/1     ContainerCreating   0          35s
busybox-6bd65c67cf-jf5s9   1/1     Running             0          35s
busybox-6bd65c67cf-m47zs   1/1     Running             0          35s
busybox-6bd65c67cf-m9cl4   1/1     Running             0          35s
busybox-6bd65c67cf-nm8wt   1/1     Running             0          35s
busybox-6bd65c67cf-qdsmq   1/1     Running             0          35s
busybox-6bd65c67cf-rnpgl   0/1     ContainerCreating   0          35s
busybox-6bd65c67cf-s4nnx   0/1     ContainerCreating   0          35s
busybox-6bd65c67cf-sp87l   1/1     Running             0          35s
busybox-6bd65c67cf-trbrv   0/1     ContainerCreating   0          35s
busybox-6bd65c67cf-vjct8   0/1     ContainerCreating   0          35s
busybox-6bd65c67cf-vspqb   0/1     ContainerCreating   0          35s
busybox-6bd65c67cf-zljwk   0/1     ContainerCreating   0          35s

查看狀態

[root@master ~]# kubectl rollout status deployment busybox
Waiting for deployment "busybox" rollout to finish: 4 of 18 updated replicas are available...
Waiting for deployment "busybox" rollout to finish: 5 of 18 updated replicas are available...
Waiting for deployment "busybox" rollout to finish: 6 of 18 updated replicas are available...
Waiting for deployment "busybox" rollout to finish: 7 of 18 updated replicas are available...
Waiting for deployment "busybox" rollout to finish: 8 of 18 updated replicas are available...
error: deployment "busybox" exceeded its progress deadline

可以看到超過最大時間沒有升級完成,就會變成超時狀態。

總結

progressDeadlineSeconds 定義 deploy 升級的最大時間。

附錄


免責聲明!

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



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