Kubernetes Resource Management
medium

Questão de Kubernetes Resource Management #019e3a4f

Enunciado da Questão
Kubernetes Resource Management
#kubernetes
#rollout
#deployment
#daemonset
#statefulset
Médio

How can you monitor the progress for an updated Deployment/DaemonSets/StatefulSets?

A

kubectl rollout watch

B

kubectl rollout progress

C

kubectl rollout state

D

kubectl rollout status

Correta

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 watch is not a valid kubectl command. The watch flag can be used with other commands (e.g., kubectl get pods --watch), but there is no kubectl rollout watch subcommand.
  • kubectl rollout progress is not a valid kubectl command. The correct subcommand is status, not progress.
  • kubectl rollout state is not a valid kubectl command. There is no state subcommand under rollout.