Can we access node/host process from the Kubernetes pod?

3/9/2020

Is there a way to access the underlying host/node's process from Kubernetes pod in the same way like we access the host/node's filesystem by using hostPath volume mount?

PS: I am trying to monitor the node process with the help of auditbeat deployed as a pod on Kubernetes.

-- Rajat Badjatya
elastic-beats
elastic-stack
elasticsearch
kubernetes

1 Answer

3/10/2020

I believe what you are looking for is hostPID: true in the PodSpec:

spec:
  hostPID: true
  containers:
  - name: show-init
    command:
    - ps
    - -p
    - "1"

should, in theory, output "/sbin/init" since it is running in the host's PID namespace

-- mdaniel
Source: StackOverflow