<p>I'm looking for a command like "gcloud config get-value project" that retrieves a project's name, but for a pod (it can retrieve any pod name that is running). I know you can get multiple pods with "kubectl get pods", but I would just like one pod name as the result.</p>

<p>I'm having to do this all the time: </p>

<pre><code>kubectl get pods       # add one of the pod names in next line
kubectl logs -f some-pod-frontend-3931629792-g589c some-app 
</code></pre>

<p>I'm thinking along the lines of "gcloud config get-value pod". Is there a command to do that correctly?</p>

<p>There are many ways, here are some examples of solutions:</p>
<p><code>kubectl get pods -o name --no-headers=true </code></p>
<p><code>kubectl get pods -o=name --all-namespaces | grep kube-proxy</code></p>
<p><code>kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{&quot;\n&quot;}}{{end}}'</code></p>
<p>For additional reading, please take a look to these links:</p>
<p><a href="https://stackoverflow.com/questions/35797906/kubernetes-list-all-running-pods-name">kubernetes list all running pods name</a></p>
<p><a href="https://stackoverflow.com/questions/35773731/kubernetes-list-all-container-id?noredirect=1&amp;lq=1">Kubernetes list all container id</a></p>
<p><a href="https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/</a></p>
