kubernetes / kubectl

Issue tracker and mirror of kubectl code
Apache License 2.0
2.82k stars 909 forks source link

Show overall readiness in `kubectl get pod` output #1633

Closed raghavan-arvind closed 1 month ago

raghavan-arvind commented 1 month ago

When you run kubectl get pod, you get output like:

NAME                                            READY   STATUS    RESTARTS   AGE
mypod1                                         1/1     Running   0          39m
mypod2                                         1/1     Running   0          39m
mypod3                                         1/1     Running   0          83d

which implies that a pod is ready if all of the containers are ready. However, this can be misleading in scenarios where other things impact pod readiness. For example, the AWS Load Balancer Controller supports these pod readiness gates: https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.1/deploy/pod_readiness_gate/. If these are failing, the kubectl output will show all containers ready but the replicaset/deployment will show the pod not ready. This makes it look like it's kubernetes itself which is not in a consistent state.

If we could instead show:

NAME                                            READY   CONTAINERS  STATUS    RESTARTS   AGE
mypod1                                         True        1/1                    Running    0                    39m
mypod2                                         False       1/1                    Running    0                   39m
mypod3                                         True         1/1                    Running   0                   83d

Or find another way to concisely convey this information that would help this issue

k8s-ci-robot commented 1 month ago

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
raghavan-arvind commented 1 month ago

I'm happy to work on this but I would need some feedback:

ardaguclu commented 1 month ago

Could you please provide the reproducing steps?. Because I'm not sure kubectl get pods prints containers are ready when containers are actually failing. Furthermore, I don't think we'd want to change this output as it is clearly not backwards compatible.

ah8ad3 commented 1 month ago

Arda is right, adding another value here is confusing in future, maybe you can ask about why the pod is not ready in your'e scenario and how to make the api to flag it as not running. Which i believe you can do that by adding some kind of probe (if applicable).

brianpursley commented 1 month ago

Does the existing -o wide output with the READINESS GATES column already provide this information as mentioned here?

kubectl get pod -o wide
NAME                          READY   STATUS    RESTARTS   AGE   IP         NODE                       READINESS GATES
nginx-test-5744b9ff84-7ftl9   1/1     Running   0          81s   10.1.2.3   ip-10-1-2-3.ec2.internal   0/1
mpuckett159 commented 1 month ago

/close Because this information is available in the wide output format (and thus the describe output as well) I'm going to close this since it is possible to get the information.

k8s-ci-robot commented 1 month ago

@mpuckett159: Closing this issue.

In response to [this](https://github.com/kubernetes/kubectl/issues/1633#issuecomment-2289211660): >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.