加入宿主机PID命名空间
挂载systemd相关目录
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: test-centos
namespace: default
spec:
selector:
matchLabels:
name: test-centos
template:
metadata:
labels:
name: test-centos
spec:
# 加入宿主机PID命名空间
hostPID: true
containers:
- image: centos
tty: true
imagePullPolicy: Always
name: test-systemd
securityContext:
privileged: false
volumeMounts:
- name: dbus
mountPath: /var/run/dbus
- name: systemd
mountPath: /run/systemd
- name: local-bin
mountPath: /usr/local/bin/
volumes:
- name: dbus
hostPath:
path: /var/run/dbus
- name: systemd
hostPath:
path: /run/systemd
- name: local-bin
hostPath:
path: /usr/local/bin/