New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl list pods in a deployment #72794

Open
dantman opened this Issue Jan 10, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@dantman
Copy link

dantman commented Jan 10, 2019

What would you like to be added:

Either an argument to kubectl get pods that allows you to list pods in a deployment; some way to get a selector string for --selector from a deployment in output_format'able way (describe deployment does not support -o and get deployment does not have selector in a format that --selector accepts); or a way to list pods in a deployment.yaml file.

Why is this needed:

I want a script that will check the status of pods in each of my deployments, things like whether the image is out of date. However right now it is impossible to list the pods in a deployment from a script without hardcoding selectors into the script.

  • kubectl get pods accepts a --selector like app=foo
  • kubectl describe deployment foo lists a selector in the same app=foo format
  • However kubectl describe outputs in a human-readable format and does not support the -o output format option for scripts
  • kubectl get deployment foo -o=custom-columns=SELECTOR:.spec.selector works but outputs the selector in a format like map[matchLabels:map[app:foo]]
  • kubetcl get -f deployment.yaml does not list pods and you cannot use kubectl get pods -f deployment.yaml

So it seems like there is no way to list the pods in a deployment. Without reading a selector from a human-readable describe command and then manually inputting it into a --selector.

@dantman

This comment has been minimized.

Copy link

dantman commented Jan 10, 2019

@kubernetes/sig-cli-feature-requests

@k8s-ci-robot k8s-ci-robot added sig/cli and removed needs-sig labels Jan 10, 2019

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Jan 10, 2019

@dantman: Reiterating the mentions to trigger a notification:
@kubernetes/sig-cli-feature-requests

In response to this:

@kubernetes/sig-cli-feature-requests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@recollir

This comment has been minimized.

Copy link

recollir commented Jan 14, 2019

What about kubectl get deployment -o wide? The last column returns selector-labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment