Questão de Kubernetes Resource Management #019e3a4f
How can you monitor the progress for an updated Deployment/DaemonSets/StatefulSets?
kubectl rollout watch
kubectl rollout progress
kubectl rollout state
kubectl rollout status
Explicação Oficial / Explicações da Comunidade
The kubectl rollout status command is used to monitor the progress of a rollout for Deployments, DaemonSets, and StatefulSets. It watches the status of the rollout until it completes successfully or fails, providing real-time updates on the number of replicas updated, available, and ready.
How it works:
When you update a Deployment, DaemonSet, or StatefulSet (e.g., changing the container image), Kubernetes initiates a rolling update. The kubectl rollout status command tracks the rollout's progress by checking the resource's status conditions. It outputs lines like "Waiting for rollout to finish: 0 of 3 updated replicas are available..." and eventually "deployment "myapp" successfully rolled out" when all replicas are updated.
Why kubectl rollout status is correct:
This command is specifically designed to monitor rollout progress. It blocks until the rollout completes, making it ideal for scripting and CI/CD pipelines. It works for Deployments, DaemonSets, and StatefulSets.
Why other commands are incorrect:
kubectl rollout watchis not a valid kubectl command. Thewatchflag can be used with other commands (e.g.,kubectl get pods --watch), but there is nokubectl rollout watchsubcommand.kubectl rollout progressis not a valid kubectl command. The correct subcommand isstatus, notprogress.kubectl rollout stateis not a valid kubectl command. There is nostatesubcommand underrollout.