How to create a Kubernetes security policy

preview_player
Показать описание
If you're looking to take your Kubernetes security to the next level, you'll want to start working with pod security policies. Here's a quick introduction to this feature.

List of Commands:

apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: psp
spec:
privileged: false
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
runAsUser:
rule: RunAsAny
fsGroup:
rule: RunAsAny
volumes:
- '*'
privileged: false
kubectl get psp psp
kind: ClusterRole
metadata:
name: psp:psp
rules:
- apiGroups:
- extensions
resources:
- podsecuritypolicies
resourceNames:
- psp
verbs:
- use
---

kind: ClusterRoleBinding
metadata:
name: psp:psp
subjects:
- kind: Group
name: system:authenticated
roleRef:
kind: ClusterRole
name: psp:psp
kubectl auth can-i use psp/psp
kubectl auth can-i use psp/psp --as-group=system:authenticated --as=any-user

Рекомендации по теме