admin管理员组

文章数量:1287885

I'm using kubectl rollout status to monitor the scale up/down of statefulset. But on scale down it doesn't work the prompt/script right away continues even tho there are still pod out which are in the process of terminating.

Example scale up:

kubectl scale sts my-cnn-box --replicas=20
##wait for most replicas to be deployed
kubectl rollout status sts my-cnn-box --timeout=15m

output

statefulset.apps/my-cnn-box scaled
Waiting for 20 pods to be ready...
Waiting for 19 pods to be ready...
Waiting for 19 pods to be ready...
Waiting for 18 pods to be ready...
Waiting for 18 pods to be ready...

Example scale down:

##clean stop
kubectl scale sts -n my-ns --replicas=0 --all
##wait for replicas to be terminated
kubectl rollout status sts my-cnn-box --timeout=15m

output, cmd prompt comes back right away so I can run the cmd few times.

partitioned roll out complete: 11 new pods have been updated...
tilo@my:/mnt/c/temp$ kubectl rollout status sts my-cnn-box --timeout=15m
partitioned roll out complete: 6 new pods have been updated...
tilo@my:/mnt/c/temp$ kubectl rollout status sts my-cnn-box --timeout=15m
partitioned roll out complete: 4 new pods have been updated...
tilo@my:/mnt/c/temp$ kubectl rollout status sts my-cnn-box --timeout=15m
partitioned roll out complete: 2 new pods have been updated...

is there a tweak to the rollout status or should it work for scale down?

I'm using kubectl rollout status to monitor the scale up/down of statefulset. But on scale down it doesn't work the prompt/script right away continues even tho there are still pod out which are in the process of terminating.

Example scale up:

kubectl scale sts my-cnn-box --replicas=20
##wait for most replicas to be deployed
kubectl rollout status sts my-cnn-box --timeout=15m

output

statefulset.apps/my-cnn-box scaled
Waiting for 20 pods to be ready...
Waiting for 19 pods to be ready...
Waiting for 19 pods to be ready...
Waiting for 18 pods to be ready...
Waiting for 18 pods to be ready...

Example scale down:

##clean stop
kubectl scale sts -n my-ns --replicas=0 --all
##wait for replicas to be terminated
kubectl rollout status sts my-cnn-box --timeout=15m

output, cmd prompt comes back right away so I can run the cmd few times.

partitioned roll out complete: 11 new pods have been updated...
tilo@my:/mnt/c/temp$ kubectl rollout status sts my-cnn-box --timeout=15m
partitioned roll out complete: 6 new pods have been updated...
tilo@my:/mnt/c/temp$ kubectl rollout status sts my-cnn-box --timeout=15m
partitioned roll out complete: 4 new pods have been updated...
tilo@my:/mnt/c/temp$ kubectl rollout status sts my-cnn-box --timeout=15m
partitioned roll out complete: 2 new pods have been updated...

is there a tweak to the rollout status or should it work for scale down?

Share Improve this question edited Feb 25 at 0:39 David Maze 160k45 gold badges243 silver badges287 bronze badges asked Feb 24 at 19:35 TiloTilo 1,2203 gold badges24 silver badges47 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

kubectl rollout status isn't primarily designed to track the removal of pods during a scale down of a StatefulSet. It primarily focuses on observing updates and new pod deployments as it is more focused on the progress of pod creation and updates.

If you want to see or watch the realtime changes of pods, you can use –watch or -w to see pods transition through statuses like Terminating and eventually disappear from the output :

kubectl get pod <your pod name> -w 

See this additional information that might help :

  • https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-status-em-
  • https://github/kubernetes/kubectl/issues/1628
  • https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#scale

本文标签: kuberneteskubectl rollout status for scale downdoesn39t workStack Overflow