Skip to content

Commit

Permalink
Merge pull request #306 from slashben/node-agent-capabilties
Browse files Browse the repository at this point in the history
Removing privileged flag on the node-agent Pod
  • Loading branch information
slashben authored Oct 24, 2023
2 parents 2987c24 + 4b7bef7 commit 6244621
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
12 changes: 11 additions & 1 deletion charts/kubescape-operator/templates/node-agent/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
tier: {{ .Values.global.namespaceTier }}
template:
metadata:
annotations:
container.apparmor.security.beta.kubernetes.io/node-agent: unconfined
labels:
app.kubernetes.io/name: {{ .Values.nodeAgent.name }}
app.kubernetes.io/instance: {{ .Release.Name }}
Expand Down Expand Up @@ -112,10 +114,18 @@ spec:
{{- end }}
securityContext:
runAsUser: 0
privileged: true
privileged: {{ .Values.nodeAgent.privileged }}
capabilities:
add:
- SYS_ADMIN
- SYS_PTRACE
- BPF
- PERFMON
- NET_ADMIN
- SYSLOG
- SYS_RESOURCE
- IPC_LOCK
- NET_RAW
volumeMounts:
- name: {{ .Values.global.cloudConfig }}
mountPath: /etc/config/clusterData.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,8 @@ matches the snapshot:
tier: ks-control-plane
template:
metadata:
annotations:
container.apparmor.security.beta.kubernetes.io/node-agent: unconfined
labels:
alt-name: node-agent
app: node-agent
Expand Down Expand Up @@ -1710,7 +1712,15 @@ matches the snapshot:
capabilities:
add:
- SYS_ADMIN
privileged: true
- SYS_PTRACE
- BPF
- PERFMON
- NET_ADMIN
- SYSLOG
- SYS_RESOURCE
- IPC_LOCK
- NET_RAW
privileged: false
runAsUser: 0
volumeMounts:
- mountPath: /etc/config/clusterData.json
Expand Down
3 changes: 3 additions & 0 deletions charts/kubescape-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ nodeAgent:
fieldRef:
fieldPath: spec.nodeName

privileged: false

volumeMounts:
- mountPath: /host
name: host
Expand Down Expand Up @@ -596,6 +598,7 @@ nodeAgent:
name: debugfs
- emptyDir:
name: data

affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
Expand Down

0 comments on commit 6244621

Please sign in to comment.