I have a Daemonset running in privileged mode in a kubernetes cluster. This is the YAML spec of the daemon set.
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: my-daemon
spec:
template:
metadata:
labels:
app: my-daemon
spec:
hostNetwork: true
serviceAccountName: my-sa-account
containers:
- name: my-daemon
image: akhilerm/my-daemon:0.5
imagePullPolicy: Always
securityContext:
privileged: true
...
...
Instead of using privileged:true
, I am moving on to linux capabilties to give permissions to the DaemonSet. Therefore, I added all the linux capabilities to the container and removed privileged:true
. This is the new YAML spec
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: my-daemon
spec:
template:
metadata:
labels:
app: my-daemon
spec:
hostNetwork: true
serviceAccountName: my-sa-account
containers:
- name: my-daemon
image: akhilerm/my-daemon:0.5
imagePullPolicy: Always
securityContext:
capabilities:
add: ["NET_BROADCAST", "NET_ADMIN", ..all CAPs..,"SYS_ADMIN"]
...
...
But when using with linux capabilities the daemon is not behaving as expected. In both cases the permission bitmap in /proc/1/status
inside the container is same.
...
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000010000
SigIgn: 0000000000000004
SigCgt: 0000000000014002
CapInh: 0000003fffffffff
CapPrm: 0000003fffffffff
CapEff: 0000003fffffffff
CapBnd: 0000003fffffffff
CapAmb: 0000000000000000
...
Is there any more fields or permissions that I need to set while using linux capabilities with a pod in kubernetes?