<p>How can I check whether it is plain vanilla docker container or
a container wrapped in a pod by way of a very simple introspection
during runtime?</p>

Naga Vijayapuram
<p>Kubernetes sets many environment variables inside the container by default. You can check if any of them are set.  eg: <code>KUBERNETES_SERVICE_HOST</code></p>

<pre><code># kubectl exec -it api-server-594f9684b-jg2d4 env | grep KUBERNETES
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_HOST=10.96.0.1
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
KUBERNETES_PORT=tcp://10.96.0.1:443
</code></pre>

<p><a href="https://kubernetes.io/docs/concepts/containers/container-environment-variables/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/containers/container-environment-variables/</a></p>
