...

/

Playing Around with the Running Pod

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:

Press + to interact
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.

Press + to interact
kubectl exec db -- ps aux

The output will be as follows:

Press + to interact
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.5 2.9 967452 59692 ? Ssl 21:47 0:03 mongod --rest --httpinterface
root 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 ...

Access this course and 1400+ top-rated courses and projects.