<p>How I can describe the pod information if that is not belongs to default namespace. With default namespace I do not have any issue.</p>
<p>But I wanted to have information for that specific pod which does have namespace align to it.</p>
<p><a href="https://i.stack.imgur.com/yG9Tm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yG9Tm.png" alt="enter image description here" /></a></p>
<p>But when I wanted to describe the same pod I could able to make that, see
<a href="https://i.stack.imgur.com/ACOFT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ACOFT.png" alt="enter image description here" /></a></p>
<p>I tried with all namespace flag but it does not allow me to query, like this.</p>
<p><code>kubectl describe  pods airflow-scheduler-646ffbfd67-k7dgh --all-namespaces</code></p>

Indrajeet Gour
<p>You would have to explicitly mention the namespace of the pod which you plan to describe. For that, you need to use the <code>-n</code> flag to kubectl command:</p>
<pre><code>kubectl describe  pods airflow-scheduler-646ffbfd67-k7dgh -n &lt;namespace&gt;
</code></pre>
<p>If you are using <code>bash</code> environment to connect to Kubernetes cluster, you can use the below function to describe the POD from any namespace, you may alias it or put it in your bashrc:</p>
<pre><code>describe_pod()
{
if [ $# -ne 1 ];then
    echo &quot;Error: Pod name is missing as input argument&quot;
    return 1
fi

pod_name=${1}

kubectl describe pod &quot;${pod_name}&quot;  -n $(kubectl get pod -A | awk -v pod=&quot;$pod_name&quot; -v def=default '$2==pod{ns=$1} END{if(!length(ns))print def; else print ns}')
}
</code></pre>
<p>Example usage:</p>
<pre><code>describe_pod &lt;pod-name-from-any-namespace&gt;
</code></pre>
<p>Eg:</p>
<pre><code>describe_pod airflow-scheduler-646ffbfd67-k7dgh
</code></pre>
<p>With a simple modification of this function, it can be used for other k8s objects.</p>
