<p>I want a command to check if ping utility is present in a pod i tried this</p>

<pre><code>kubectl exec -it auxiliary-etcd-ubuntu -n kube-system -c etcd-auxiliary-0 ping -c 1 127.0.0.1 ; echo $?
</code></pre>

<p>Response is.</p>

<pre><code>Error from server (BadRequest): container 1 is not valid for pod auxiliary-etcd-ubuntu
1
</code></pre>

<p>Is there any other better to just check if ping utility is already present or installed in a kubernetes pod.</p>

<p>Thanks in advance.</p>

user3398900
<p>If you just want to check if command is present/installed inside the <code>POD</code></p>

<p><code>kubectl exec -it auxiliary-etcd-ubuntu -- which ping ; echo $?</code></p>

<p>This will give you exit status <code>1</code> if it doesn't exist.</p>

<p>Also</p>

<p><code>kubectl exec -it auxiliary-etcd-ubuntu -- whereis ping</code></p>

<p>Which will provide a path to install location.</p>
