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
3 months agoLynda
3 months agoJade
4 months agoJanessa
4 months agoAlyce
4 months agoAlesia
4 months agoAmie
4 months agoRory
5 months agoJerlene
5 months agoMattie
5 months agoBrett
5 months agoDiane
5 months agoMarta
5 months agoTricia
10 months agoWalker
9 months agoArlen
9 months agoMajor
9 months agoTimothy
10 months agoLorenza
10 months agoDiane
9 months agoDiane
9 months agoDiane
10 months agoJanet
11 months agoJacinta
9 months agoEstrella
9 months agoCherri
9 months agoHillary
10 months agoRuthann
11 months agoVincent
10 months agoTrinidad
10 months agoJenifer
11 months agoVan
11 months agoYuki
11 months ago