标签:min ext asn binding rom drop source pre server
容器中的上下文限制,在pod仍然适用
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: default
namespace: default
spec:
hostIPC: false
hostPID: false
hostNetwork: false
hostPorts:
- min: 10000
max: 11000
- min: 13000
max: 14000
privileged: true
readOnlyRootFilesystem: false
runAsUser:
rule: RunAsAny
fsGroup:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
seLinux:
rule: RunAsAny
volumes:
- '*'
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: privileged
namespace: default
spec:
hostIPC: false
hostPID: false
hostNetwork: false
hostPorts:
- min: 10000
max: 11000
- min: 13000
max: 14000
privileged: true
readOnlyRootFilesystem: false
runAsUser:
rule: RunAsAny
fsGroup:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
seLinux:
rule: RunAsAny
volumes:
- '*'
kubectl create clusterrole psp-default --verb=use --resources=podsecuritypolicy --resource-name=default
kubectl create clusterrole psp-privileged --verb=use --resources=podsecuritypolicy --resource-name=privileged
kubectl create clusterrolebinding --clusterrole=psp-default --Groups=system:authenticated
kubectl create clusterrolebinding --clusterrole=psp-privileged --user=admin
kubectl create -f centos_1.yaml
Error from server (Forbidden): error when creating "centos_1.yaml": pods "centos5" is forbidden: unable to validate against any pod security policy: [spec.containers[0].securityContext.privileged: Invalid value: true: Privileged containers are not allowed]
标签:min ext asn binding rom drop source pre server
原文地址:https://www.cnblogs.com/zhangjxblog/p/12167676.html