Skip to content

Commit ed52584

Browse files
authored
Merge pull request #169 from jokuniew/securitycontext
feat: enable containers securitycontext
2 parents 5ede328 + 241b122 commit ed52584

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

bootstrap/config/default/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ patchesStrategicMerge:
3939
# 'CERTMANAGER' needs to be enabled to use ca injection
4040
- webhookcainjection_patch.yaml
4141

42+
# Adds or overrides securityContext settings for containers to enforce security best practices,
43+
# such as running as non-root, dropping capabilities, or setting read-only root filesystems.
44+
- patch-securitycontext.yaml
45+
4246
# the following config is for teaching kustomize how to do var substitution
4347
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
4448
configurations:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: controller-manager
5+
namespace: system
6+
spec:
7+
template:
8+
spec:
9+
containers:
10+
- name: manager
11+
securityContext:
12+
runAsNonRoot: true
13+
allowPrivilegeEscalation: false
14+
capabilities:
15+
drop: ["ALL"]
16+
seccompProfile:
17+
type: RuntimeDefault
18+
- name: kube-rbac-proxy
19+
securityContext:
20+
runAsNonRoot: true
21+
allowPrivilegeEscalation: false
22+
capabilities:
23+
drop: ["ALL"]
24+
seccompProfile:
25+
type: RuntimeDefault

controlplane/config/default/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ patchesStrategicMerge:
3939
# 'CERTMANAGER' needs to be enabled to use ca injection
4040
- webhookcainjection_patch.yaml
4141

42+
# Adds or overrides securityContext settings for containers to enforce security best practices,
43+
# such as running as non-root, dropping capabilities, or setting read-only root filesystems.
44+
- patch-securitycontext.yaml
45+
4246
# the following config is for teaching kustomize how to do var substitution
4347
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
4448
configurations:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: controller-manager
5+
namespace: system
6+
spec:
7+
template:
8+
spec:
9+
containers:
10+
- name: manager
11+
securityContext:
12+
runAsNonRoot: true
13+
allowPrivilegeEscalation: false
14+
capabilities:
15+
drop: ["ALL"]
16+
seccompProfile:
17+
type: RuntimeDefault
18+
- name: kube-rbac-proxy
19+
securityContext:
20+
runAsNonRoot: true
21+
allowPrivilegeEscalation: false
22+
capabilities:
23+
drop: ["ALL"]
24+
seccompProfile:
25+
type: RuntimeDefault

0 commit comments

Comments
 (0)