问题描述
我正在尝试将守护进程配置为在全局 pid 命名空间上运行,从而能够查看主机中的其他进程,包括容器的进程。
我找不到实现此目标的选项。
一般来说,我正在寻找的只是在主机级别接近 sidecar 容器 shareProcessNamespace
属性。
解决方法
有一个属性允许这样做 - hostPID: true
所以 yaml 文件应该看起来像这样:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: busybox
spec:
selector:
matchLabels:
name: busybox
template:
metadata:
labels:
name: busybox
spec:
hostPID: true
containers:
- name: busybox
image: busybox
command: [ "sh","-c","sleep 1h" ]
更多信息: