<p>Is there a way to use <code>kubectl</code> to list only the pods belonging to a deployment?
Currently, I do this to get pods:</p>
<p><code>kubectl get pods| grep hello</code></p>
<p>But it seems an overkill to get ALL the pods when I am interested to know only the pods for a given deployment. I use the output of this command to see the status of all pods, and then possibly exec into one of them.</p>
<p>I also tried <code>kc get -o wide deployments hellodeployment</code>, but it does not print the Pod names.</p>

Bajal
<p>There's a <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/" rel="noreferrer">label</a> in the pod for the <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/" rel="noreferrer">selector</a> in the deployment. That's how a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#creating-a-deployment" rel="noreferrer">deployment</a> manages its pods. For example for the label or selector <code>app=http-svc</code> you can do something like that this and avoid using <code>grep</code> and listing all the pods (this becomes useful as your number of pods becomes very large)</p>
<p>here are some examples command line:</p>
<pre><code># single label
kubectl get pods -l=app=http-svc
kubectl get pods --selector=app=http-svc
# multiple labels
kubectl get pods --selector key1=value1,key2=value2
</code></pre>
