2019-10-04 18:15:39 -07:00
|
|
|
apiVersion: kyverno.io/v1alpha1
|
|
|
|
kind: ClusterPolicy
|
|
|
|
metadata:
|
|
|
|
name: validate-container-capablities
|
2019-10-11 18:57:16 -07:00
|
|
|
annotations:
|
|
|
|
policies.kyverno.io/category: Security Context
|
2019-10-14 16:33:19 -07:00
|
|
|
policies.kyverno.io/description: Linux divides the privileges traditionally associated with
|
|
|
|
superuser into distinct units, known as capabilities, which can be independently enabled
|
|
|
|
or disabled by listing them in 'securityContext.capabilites'.
|
2019-10-04 18:15:39 -07:00
|
|
|
spec:
|
|
|
|
rules:
|
|
|
|
- name: validate-container-capablities
|
|
|
|
match:
|
|
|
|
resources:
|
|
|
|
kinds:
|
|
|
|
- Pod
|
|
|
|
validate:
|
2019-10-14 10:47:54 -07:00
|
|
|
message: "Allow certain linux capability"
|
2019-10-04 18:15:39 -07:00
|
|
|
pattern:
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- securityContext:
|
|
|
|
capabilities:
|
|
|
|
add: ["NET_ADMIN"]
|