All Policies
Disable Service Discovery
Not all Pods require communicating with other Pods or resolving in-cluster Services. For those, disabling service discovery can increase security as the Pods are limited to what they can see. This policy mutates Pods to set dnsPolicy to `Default` and enableServiceLinks to `false`.
Policy Definition
/other/disable_service_discovery/disable-service-discovery.yaml
1apiVersion: kyverno.io/v1
2kind: ClusterPolicy
3metadata:
4 name: disable-service-discovery
5 annotations:
6 policies.kyverno.io/title: Disable Service Discovery
7 policies.kyverno.io/category: Other, EKS Best Practices
8 policies.kyverno.io/subject: Pod
9 kyverno.io/kyverno-version: 1.8.0-rc2
10 kyverno.io/kubernetes-version: "1.24"
11 policies.kyverno.io/minversion: 1.6.0
12 policies.kyverno.io/description: >-
13 Not all Pods require communicating with other Pods or resolving in-cluster Services.
14 For those, disabling service discovery can increase security as the Pods are limited
15 to what they can see. This policy mutates Pods to set dnsPolicy to `Default` and
16 enableServiceLinks to `false`.
17spec:
18 rules:
19 - name: example-configmap-lookup
20 match:
21 any:
22 - resources:
23 kinds:
24 - Pod
25 mutate:
26 patchStrategicMerge:
27 spec:
28 dnsPolicy: Default
29 enableServiceLinks: false