更新时间:2024-02-01 GMT+08:00
k8spspseccomp
作用
约束PodSecurityPolicy上的“seccomp.security.alpha.kubernetes.io/allowedProfileNames”注解。
策略实例示例
以下策略实例展示了策略定义生效的资源类型,parameters中allowedProfiles定义了允许的注解。
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sPSPSeccomp
metadata:
name: psp-seccomp
spec:
match:
kinds:
- apiGroups: [""]
kinds: ["Pod"]
parameters:
allowedProfiles:
- runtime/default
- docker/default
符合策略实例的资源定义
示例中的container.seccomp.security.alpha.kubernetes.io/nginx注解的value在设定的值列表中,符合策略定义。
apiVersion: v1
kind: Pod
metadata:
name: nginx-seccomp-allowed
annotations:
container.seccomp.security.alpha.kubernetes.io/nginx: runtime/default
labels:
app: nginx-seccomp
spec:
containers:
- name: nginx
image: nginx
不符合策略实例的资源定义
示例中的container.seccomp.security.alpha.kubernetes.io/nginx注解的value没在设定的值列表中,不符合策略定义。
apiVersion: v1
kind: Pod
metadata:
name: nginx-seccomp-disallowed
annotations:
container.seccomp.security.alpha.kubernetes.io/nginx: unconfined
labels:
app: nginx-seccomp
spec:
containers:
- name: nginx
image: nginx
父主题: 使用策略定义库