k8spspallowprivilegeescalationcontainer
作用
约束PodSecurityPolicy中的“allowPrivilegeEscalation”字段为false。
策略实例示例
以下策略实例展示了策略定义生效的资源类型。
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sPSPAllowPrivilegeEscalationContainer
metadata:
name: psp-allow-privilege-escalation-container
spec:
match:
kinds:
- apiGroups: [""]
kinds: ["Pod"]
符合策略实例的资源定义
示例中allowPrivilegeEscalation的值为false,符合策略实例。
apiVersion: v1
kind: Pod
metadata:
name: nginx-privilege-escalation-allowed
labels:
app: nginx-privilege-escalation
spec:
containers:
- name: nginx
image: nginx
securityContext:
allowPrivilegeEscalation: false
不符合策略实例的资源定义
示例中allowPrivilegeEscalation的值不为false,不符合策略实例。
apiVersion: v1
kind: Pod
metadata:
name: nginx-privilege-escalation-disallowed
labels:
app: nginx-privilege-escalation
spec:
containers:
- name: nginx
image: nginx
securityContext:
allowPrivilegeEscalation: true