Playing Around with the Running Pod
Explore more about the running od in the cluster.
Describing resources
In many cases, it is more useful to describe resources by referencing the file that defines them. That way, there is no confusion or need to remember the names of resources.
Instead of using kubectl describe pod db
, we could have executed the command as follows:
kubectl describe -f db.yml
The output should be the same as the previous lesson because, in both cases, kubectl
sent a request to the Kubernetes API requesting information about the Pod named “db”.
Executing a new process
Just as with Docker, we can execute a new process inside a running container inside a Pod.
kubectl exec db -- ps aux
The output will be as follows:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.5 2.9 967452 59692 ? Ssl 21:47 0:03 mongod --rest --httpinterfaceroot 31 0.0 0.0 17504 1980 ? Rs 21:58 0:00 ps aux
We told Kubernetes that we’d like to execute a process inside the first container of the Pod db
. Since our Pod defines only one container, this container and the first container are one and the same. The --container
(or -c
) argument can be ...