<p>I have backend service description in skaffold.yaml similiar this:</p>

<pre><code>...
deploy:
  helm:
    releases:
    - name: 'myapp-backend'
      chartPath: myapp-chart-backend
      values:
        APP_IMAGE: ...
      namespace: myapp-ns
      recreatePods: true
...
</code></pre>

<p>After cluster is up I have list pods and <code>kubectl get pods</code> return </p>

<pre><code>...
myapp-backend-7dbf4b6fb8-kw7zv
myapp-backend-redis-646f454bcb-7thrc
...
</code></pre>

<p>I need full name of pod (<code>myapp-backend-7dbf4b6fb8-kw7zv</code>) to use it in <code>kubectl cp</code> command, which requires full name.
But this command I run in my bash script, so I need to get full name <code>myapp-backend-7dbf4b6fb8-kw7zv</code> by name <code>myapp-backend</code>.</p>

Log
<p>Assuming you know the name in the deployment ('myapp-backend' in this case), you can:</p>

<pre><code>kubectl get pods --selector=app=myapp-backend -o jsonpath='{.items[*].metadata.name}'
</code></pre>

<p><strong>Update</strong></p>

<p>Since I obviously don't have an access to your environment, I've rather provided a a general path for solution, you can fiddle with this command but the idea probably will remain the same:</p>

<ol>
<li>call <code>kubectl get pods --selector=...</code> (Its possible that you should add more selectors in __your__environment)</li>
<li>Assume that the output is json. Here one nifty trick is to examine json by using: <code>kubectl get pods --selector=app=&lt;myapp-backend&gt; -o json</code>. You'll get a properly formatted json that you can inspect and see what part of it you actually want to get.</li>
<li>query by jsonpath only the part of json that you want by providing a jsonpath expression, for example <code>{.items[0].metadata.name}</code> will also work</li>
</ol>
