Create a PSP that will only allow the persistentvolumeclaim as the volume type in the namespace restricted.
Create a new PodSecurityPolicy named prevent-volume-policy which prevents the pods which is having different volumes mount apart from persistentvolumeclaim.
Create a new ServiceAccount named psp-sa in the namespace restricted.
Create a new ClusterRole named psp-role, which uses the newly created Pod Security Policy prevent-volume-policy
Create a new ClusterRoleBinding named psp-role-binding, which binds the created ClusterRole psp-role to the created SA psp-sa.
Hint:
Also, Check the Configuration is working or not by trying to Mount a Secret in the pod maifest, it should get failed.
POD Manifest:
apiVersion: v1
kind: Pod
metadata:
name:
spec:
containers:
- name:
image:
volumeMounts:
- name:
mountPath:
volumes:
- name:
secret:
secretName:
Melinda
5 months agoLynda
5 months agoJade
6 months agoJanessa
6 months agoAlyce
6 months agoAlesia
6 months agoAmie
6 months agoRory
7 months agoJerlene
7 months agoMattie
7 months agoBrett
7 months agoDiane
7 months agoMarta
7 months agoTricia
12 months agoWalker
11 months agoArlen
11 months agoMajor
11 months agoTimothy
12 months agoLorenza
1 year agoDiane
11 months agoDiane
11 months agoDiane
12 months agoJanet
1 year agoJacinta
11 months agoEstrella
11 months agoCherri
11 months agoHillary
12 months agoRuthann
1 year agoVincent
12 months agoTrinidad
12 months agoJenifer
1 year agoVan
1 year agoYuki
1 year ago