Add security context to meet PodSecurity restricted standard

- Set runAsNonRoot and runAsUser to 65534 (nobody)
- Disable privilege escalation
- Drop all Linux capabilities
- Use RuntimeDefault seccomp profile
- Applies to both migration job and main deployment
This commit is contained in:
Graham McIntire 2026-01-03 16:02:27 -06:00
parent d7481dc0fd
commit 66ed55d78e
No known key found for this signature in database
2 changed files with 30 additions and 0 deletions

View file

@ -16,10 +16,25 @@ spec:
spec:
imagePullSecrets:
- name: gitlab-registry
securityContext:
runAsNonRoot: true
runAsUser: 65534
fsGroup: 65534
seccompProfile:
type: RuntimeDefault
containers:
- name: towerops
image: registry.gitlab.com/graham/towerops:latest
imagePullPolicy: Always
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 65534
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
ports:
- containerPort: 4000
name: http

View file

@ -20,10 +20,25 @@ spec:
restartPolicy: Never
imagePullSecrets:
- name: gitlab-registry
securityContext:
runAsNonRoot: true
runAsUser: 65534
fsGroup: 65534
seccompProfile:
type: RuntimeDefault
containers:
- name: migrate
image: registry.gitlab.com/graham/towerops:IMAGE_TAG
command: ["/app/bin/towerops", "eval", "Towerops.Release.migrate()"]
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 65534
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
env:
- name: MIX_ENV
value: "prod"