kubernetesrolling-updates

How to wait X second to finish rolling update in k8s?


I am using k8s to deploy my docker apps.

Once app is stated it took 20-30s to be ready, app is huge it took some time while booting.

Boot average time is 20-30s. I would like to wait for 60s during the rolling update. Because for now, old pod is terminated while booting new app (in new pod).

How can I do it?


Solution

  • Configure readiness probe and startup probe in the pod spec with a failureThreshold * periodSeconds long enough to cover the worse case startup time.As an example.

    ports:
    - name: readiness-port
      containerPort: 8080
      hostPort: 8080
    
    readinessProbe:
      httpGet:
        path: /healthz
        port: readiness-port
      failureThreshold: 1
      periodSeconds: 10
    
    startupProbe:
      httpGet:
        path: /healthz
        port: readiness-port
      failureThreshold: 30
      periodSeconds: 10