Skip to content

Commit f55bc32

Browse files
committed
Run all containers as privileged
On systems with SELinux enabled, all containers that access the CSI driver socket must have the same security setting as the driver that exposes the socket. Since the socket is exposed by privileged container, all sidecars must be privileged too.
1 parent 42be366 commit f55bc32

File tree

6 files changed

+33
-0
lines changed

6 files changed

+33
-0
lines changed

deploy/kubernetes-1.16/hostpath/csi-hostpath-attacher.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ spec:
4444
args:
4545
- --v=5
4646
- --csi-address=/csi/csi.sock
47+
securityContext:
48+
# This is necessary only for systems with SELinux, where
49+
# non-privileged sidecar containers cannot access unix domain socket
50+
# created by privileged CSI driver container.
51+
privileged: true
4752
volumeMounts:
4853
- mountPath: /csi
4954
name: socket-dir

deploy/kubernetes-1.16/hostpath/csi-hostpath-plugin.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ spec:
4646
- --csi-address=/csi/csi.sock
4747
- --kubelet-registration-path=/var/lib/kubelet/plugins/csi-hostpath/csi.sock
4848
securityContext:
49+
# This is necessary only for systems with SELinux, where
50+
# non-privileged sidecar containers cannot access unix domain socket
51+
# created by privileged CSI driver container.
4952
privileged: true
5053
env:
5154
- name: KUBE_NODE_NAME
@@ -107,6 +110,11 @@ spec:
107110
volumeMounts:
108111
- mountPath: /csi
109112
name: socket-dir
113+
securityContext:
114+
# This is necessary only for systems with SELinux, where
115+
# non-privileged sidecar containers cannot access unix domain socket
116+
# created by privileged CSI driver container.
117+
privileged: true
110118
image: quay.io/k8scsi/livenessprobe:v1.1.0
111119
args:
112120
- --csi-address=/csi/csi.sock

deploy/kubernetes-1.16/hostpath/csi-hostpath-provisioner.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ spec:
4646
- --csi-address=/csi/csi.sock
4747
- --connection-timeout=15s
4848
- --feature-gates=Topology=true
49+
securityContext:
50+
# This is necessary only for systems with SELinux, where
51+
# non-privileged sidecar containers cannot access unix domain socket
52+
# created by privileged CSI driver container.
53+
privileged: true
4954
volumeMounts:
5055
- mountPath: /csi
5156
name: socket-dir

deploy/kubernetes-1.16/hostpath/csi-hostpath-resizer.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ spec:
4444
args:
4545
- -v=5
4646
- -csi-address=/csi/csi.sock
47+
securityContext:
48+
# This is necessary only for systems with SELinux, where
49+
# non-privileged sidecar containers cannot access unix domain socket
50+
# created by privileged CSI driver container.
51+
privileged: true
4752
volumeMounts:
4853
- mountPath: /csi
4954
name: socket-dir

deploy/kubernetes-1.16/hostpath/csi-hostpath-snapshotter.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ spec:
4545
- -v=5
4646
- --csi-address=/csi/csi.sock
4747
- --connection-timeout=15s
48+
securityContext:
49+
# This is necessary only for systems with SELinux, where
50+
# non-privileged sidecar containers cannot access unix domain socket
51+
# created by privileged CSI driver container.
52+
privileged: true
4853
volumeMounts:
4954
- mountPath: /csi
5055
name: socket-dir

deploy/kubernetes-1.16/hostpath/csi-hostpath-testing.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ spec:
4949
args:
5050
- tcp-listen:10000,fork,reuseaddr
5151
- unix-connect:/csi/csi.sock
52+
securityContext:
53+
# This is necessary only for systems with SELinux, where
54+
# non-privileged sidecar containers cannot access unix domain socket
55+
# created by privileged CSI driver container.
56+
privileged: true
5257
volumeMounts:
5358
- mountPath: /csi
5459
name: socket-dir

0 commit comments

Comments
 (0)