All Policies
Require Multiple Replicas
Deployments with a single replica cannot be highly available and thus the application may suffer downtime if that one replica goes down. This policy validates that Deployments have more than one replica.
Policy Definition
/other/require_deployments_have_multiple_replicas.yaml
1apiVersion: kyverno.io/v1
2kind: ClusterPolicy
3metadata:
4 name: deployment-has-multiple-replicas
5 annotations:
6 policies.kyverno.io/title: Require Multiple Replicas
7 policies.kyverno.io/category: Sample
8 policies.kyverno.io/severity: medium
9 policies.kyverno.io/subject: Deployment
10 policies.kyverno.io/description: >-
11 Deployments with a single replica cannot be highly available and thus the application
12 may suffer downtime if that one replica goes down. This policy validates that Deployments
13 have more than one replica.
14spec:
15 validationFailureAction: audit
16 rules:
17 - name: deployment-has-multiple-replicas
18 match:
19 resources:
20 kinds:
21 - Deployment
22 validate:
23 message: "Deployments should have more than one replica to ensure availability."
24 pattern:
25 spec:
26 replicas: ">1"