kubectl wait sometimes timed out unexpectedly

7/4/2020

I just add kubectl wait --for=condition=ready pod -l app=appname --timeout=30s in the last step of BitBucket Pipeline to report any deployment failure if the new pod somehow producing error.

I realize that the wait doesn't really consistent. Sometimes it gets timed out even if new pod from new image doesn't producing any error, pod turn to ready state.

Try to always change deployment.yaml or push newer image everytime to test this, the result is inconsistent.

BTW, I believe using kubectl rollout status doesn't suitable, I think because it just return after the deployment done without waiting for pod ready.

Note that there is not much difference if I change timeout from 30s to 5m since apply or rollout restart is quite instant.

  • kubectl version: 1.17
  • AWS EKS: latest 1.16
-- CallMeLaNN
kubectl
kubernetes

1 Answer

8/24/2020

I'm placing this answer for better visibility as noted in the comments this indeed solves some problems with kubectl wait behavior.

I managed to replicate the issue and have some timeouts when my client version was older than server version. You have to match your client version with server in order to kubectl wait work properly.

-- acid_fuji
Source: StackOverflow