2019-10-10 12:29:48 -07:00
|
|
|
apiVersion : kyverno.io/v1alpha1
|
|
|
|
kind: ClusterPolicy
|
|
|
|
metadata:
|
|
|
|
name: validate-disallow-automoutingapicred
|
2019-10-11 18:57:16 -07:00
|
|
|
annotations:
|
|
|
|
policies.kyverno.io/category: API Server Access Control
|
|
|
|
policies.kyverno.io/description: Disable automounting API credentials for service account, restricting access of API from inside a pod
|
2019-10-10 12:29:48 -07:00
|
|
|
spec:
|
|
|
|
rules:
|
|
|
|
- name: disallow-automoutingapicred
|
|
|
|
match:
|
|
|
|
resources:
|
|
|
|
kinds:
|
|
|
|
- Pod
|
|
|
|
validate:
|
|
|
|
message: "Deny automounting API credentials"
|
|
|
|
pattern:
|
|
|
|
spec:
|
|
|
|
=(serviceAccountName): "*"
|
|
|
|
automountServiceAccountToken: false
|