<p>I  just want to list pods with their <code>.status.podIP</code> as an extra column.
It seems that as soon as I specify <code>-o=custom-colums=</code> the default columns <code>NAME, READY, STATUS, RESTARTS, AGE</code> will disappear.</p>
<p>The closest I was able to get is</p>
<pre><code>kubectl get pod -o wide -o=custom-columns=&quot;NAME:.metadata.name,STATUS:.status.phase,RESTARTS:.status.containerStatuses[0].restartCount,PODIP:.status.podIP&quot;
</code></pre>
<p>but that is not really equivalent to the the default columns in the following way:</p>
<ul>
<li>READY: I don't know how to get the default output (which looks like <code>2/2</code> or <code>0/1</code> by using custom columns</li>
<li>STATUS: In the default behaviour STATUS, can be Running, Failed, <strong>Evicted</strong>, but <code>.status.phase</code> will never be <code>Evicted</code>. It seems that the default STATUS is a combination of <code>.status.phase</code> and <code>.status.reason</code>. <strong>Is there a way to say show <code>.status.phase</code> if it's Running but if not show <code>.status.reason</code>?</strong></li>
<li>RESTARTS: This only shows the restarts of the first container in the pod (I guess the sum of all containers would be the correct one)</li>
<li>AGE: Again I don't know how to get the age of the pod using custom-columns</li>
</ul>
<p>Does anybody know the definitions of the default columns in custom-columns syntax?</p>

<p>I checked the differences between in API requests between the <code>kubectl get pods</code> and <code>kubectl -o custom columns</code>:</p>
<ul>
<li>With aggregation:</li>
</ul>
<pre class="lang-json prettyprint-override"><code>curl -k -v -XGET -H Accept: application/json;as=Table;v=v1;g=meta.k8s.io,application/json;as=Table;v=v1beta1;g=meta.k8s.io,application/json -H User-Agent: kubectl/v1.18.8 (linux/amd64) kubernetes/9f2892a http://127.0.0.1:8001/api/v1/namespaces/default/pods?limit=500 
</code></pre>
<ul>
<li>Without aggregation:</li>
</ul>
<pre class="lang-json prettyprint-override"><code>curl -k -v -XGET -H Accept: 
application/json -H User-Agent: kubectl/v1.18.8 (linux/amd64) kubernetes/9f2892a http://127.0.0.1:8001/api/v1/namespaces/default/pods?limit=500
</code></pre>
<p>So you will notice that when <code>-o custom columns</code> is used, kubectl gets <code>PodList</code> instead of <code>Table</code> in response body. Podlist does not have that aggregated data, so to my understanding it is not possible to get the same output with kubectl pods using <code>custom-column</code>.</p>
<p>Here's a <a href="https://github.com/kubernetes/kubernetes/blob/ea0764452222146c47ec826977f49d7001b0ea8c/pkg/printers/internalversion/printers.go#L828" rel="nofollow noreferrer">code</a> snippet responsible for the output that you desire. Possible solution would be to fork the client and customize it to your own needs since as you already might notice this output requires some custom logic. Another possible solution would be to use one of the Kubernetes <a href="https://kubernetes.io/docs/reference/using-api/client-libraries/" rel="nofollow noreferrer">api client libraries</a>.  Lastly you may want to try <a href="https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/" rel="nofollow noreferrer">extend kubectl</a> functionalities with <a href="https://github.com/ishantanu/awesome-kubectl-plugins" rel="nofollow noreferrer">kubectl plugins</a>.</p>
