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:
Tricia
2 months agoWalker
12 days agoArlen
17 days agoMajor
29 days agoTimothy
2 months agoLorenza
2 months agoDiane
14 days agoDiane
15 days agoDiane
1 months agoJanet
2 months agoJacinta
15 days agoEstrella
17 days agoCherri
29 days agoHillary
2 months agoRuthann
3 months agoVincent
2 months agoTrinidad
2 months agoJenifer
3 months agoVan
3 months agoYuki
3 months ago