Why the linux ps command "sees" the processes ran by K8s pods?


I have a K8s cluster created in the context of the Linux Foundation’s CKAD course (LFD259). So it is a "bare metal" cluster created with kubeadm.

So I have a metrics-server deployment running on the worker node:

[email protected]:~$ k get deployments.apps metrics-server -o yaml | grep -A10 args
      - args:
        - --secure-port=4443
        - --cert-dir=/tmp
        - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
        - --kubelet-use-node-status-port
        - --metric-resolution=15s
        - --kubelet-insecure-tls
        image: k8s.gcr.io/metrics-server/metrics-server:v0.6.1
        imagePullPolicy: IfNotPresent
          failureThreshold: 3
[email protected]:~$ k get pod metrics-server-6894588c69-fpvtt -o wide
NAME                              READY   STATUS    RESTARTS   AGE     IP               NODE     NOMINATED NODE   READINESS GATES
metrics-server-6894588c69-fpvtt   1/1     Running   0          4d15h   worker   <none>           <none>
[email protected]:~$

It is my understanding that the pod’s process runs inside a container running on the worker node. However, I am completely puzzled by the fact that the linux ps command "sees" it:

[email protected]:~$ ps aux | grep kubelet-preferred-address-types
ubuntu   1343092  0.3  0.6 752468 49612 ?        Ssl  Oct28  20:25 /metrics-server --secure-port=4443 --cert-dir=/tmp --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --kubelet-use-node-status-port --metric-resolution=15s --kubelet-insecure-tls
student  3310743  0.0  0.0   8184  2532 pts/0    S+   17:39   0:00 grep --color=auto kubelet-preferred-address-types
[email protected]:~$

What am I missing?


A container is just a process running on your host with some isolation features enabled. The isolation only works in one way: a container can’t see resources on your host, but your host has access to all the resources running in a container.

Because a container is just a process, it shows up in ps (as do any processes that are spawned inside the container).

See e.g.:

Answered By – larsks

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published