<p>How to Get a container’s full id from inside of itself in Kubernetes. I want to add container id in my application log which is running as Kubernetes container  </p>

Kundan Kumar
<p>The <code>HOSTNAME</code> environment variable is readily available in any container running on Kubernetes and gives the unique name of the pod in which the container is running. Use the means provided by the logging framework to acccesss the environment variable and make it part of the logging pattern, or to programatically add its value to log entries.</p>

<p>That should do for application logging purposes assuming there is only one <em>application</em> container in the pod (which is regarded as a best practice anyway).</p>
