<p>I have read about the Appdynamics in Kubernetes but I got confused.</p>

<p>The scenario is like I am having EC2 under which Kubernetes is running which is having POD and under 1 pod, multiple container is running. </p>

<p>Where I have to install machine-agent? In EC2 or in daemon set?</p>

<p>And where I have to install app-agent? do I have to add app-agent in each container Dockerfile?</p>

<p>And lastly, what would be my hostName and uniqueHostId?</p>

<p>As stated on the AppD docs regarding <a href="https://docs.appdynamics.com/display/CLOUD/Kubernetes+and+AppDynamics+APM" rel="nofollow noreferrer">Kubernetes and AppDynamics APM</a></p>
<p><a href="https://i.stack.imgur.com/qieEb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qieEb.jpg" alt="enter image description here" /></a></p>
<blockquote>
<p>Install a Standalone Machine Agent (1) in a Kubernetes node.</p>
<p>Install an APM Agent (2) inside each container in a pod you want to monitor.</p>
<p>The Standalone Machine Agent then collects hardware metrics for each monitored container, as well as Machine and Server metrics for the host (3), and forwards the metrics to the Controller.</p>
</blockquote>
<p>ContainerID and UniqueHostID can be taken from <code>/proc/self/cgroup</code></p>
<blockquote>
<p>ContainerID <code>cat /proc/self/cgroup | awk -F '/' '{print $NF}'  | head -n 1</code></p>
<p>UniqueHostID <code>sed -rn '1s#.*/##; 1s/(.{12}).*/\1/p' /proc/self/cgroup</code></p>
</blockquote>
