fix: add PodSecurity contexts to all poimen deployments
- runAsNonRoot, runAsUser 1000, seccompProfile RuntimeDefault - Drop ALL capabilities, no privilege escalation - readOnlyRootFilesystem on memory (with /tmp emptyDir) - git-sync init runs as root with only CHOWN+DAC_OVERRIDE caps - All pods use their service accounts
This commit is contained in:
@@ -19,9 +19,23 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: poimen-memory
|
app.kubernetes.io/name: poimen-memory
|
||||||
spec:
|
spec:
|
||||||
|
serviceAccountName: poimen-memory
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1000
|
||||||
|
runAsGroup: 999
|
||||||
|
fsGroup: 999
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
containers:
|
containers:
|
||||||
- name: memory
|
- name: memory
|
||||||
image: forgejo.riotpiao.com/rock/poimen-memory:latest
|
image: forgejo.riotpiao.com/rock/poimen-memory:latest
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
@@ -85,10 +99,15 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /data
|
mountPath: /data
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
volumes:
|
volumes:
|
||||||
- name: data
|
- name: data
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: poimen-memory-vault
|
claimName: poimen-memory-vault
|
||||||
|
- name: tmp
|
||||||
|
emptyDir:
|
||||||
|
sizeLimit: 64Mi
|
||||||
# Tolerate control-plane nodes
|
# Tolerate control-plane nodes
|
||||||
tolerations:
|
tolerations:
|
||||||
- key: node-role.kubernetes.io/control-plane
|
- key: node-role.kubernetes.io/control-plane
|
||||||
|
|||||||
@@ -21,9 +21,26 @@ spec:
|
|||||||
app.kubernetes.io/part-of: poimen-memory
|
app.kubernetes.io/part-of: poimen-memory
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: obsidian-server
|
serviceAccountName: obsidian-server
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1000
|
||||||
|
runAsGroup: 1000
|
||||||
|
fsGroup: 1000
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: git-sync-init
|
- name: git-sync-init
|
||||||
image: alpine/git:latest
|
image: alpine/git:latest
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: false
|
||||||
|
runAsUser: 0
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
add:
|
||||||
|
- CHOWN
|
||||||
|
- DAC_OVERRIDE
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
@@ -50,6 +67,11 @@ spec:
|
|||||||
- name: obsidian-server
|
- name: obsidian-server
|
||||||
image: ppatlabs/obsidian:latest
|
image: ppatlabs/obsidian:latest
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
containerPort: 27124
|
containerPort: 27124
|
||||||
|
|||||||
Reference in New Issue
Block a user