Skip to content

Instantly share code, notes, and snippets.

View ShubhanjanMedhi-dev's full-sized avatar

Shubhanjan Medhi ShubhanjanMedhi-dev

View GitHub Profile
$ helm repo add kyverno https://kyverno.github.io/kyverno/
$ helm repo update
$ helm install kyverno kyverno/kyverno \
--namespace kyverno \
--create-namespace
$ kubectl -n kyverno get pods
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: require-deployment-label
spec:
validationFailureAction: enforce
rules:
- name: require-deployment-label
match:
resources:
$ kubectl apply -f validating_policy.yaml
$ kubectl create deployment webhook-test --image=nginx
apiVersion: apps/v1
kind: Deployment
metadata:
name: webhook-test
labels:
app: webhook-test
company: squadcast
spec:
replicas: 1
selector:
$ kubectl apply -f webhook.yaml
$ kubectl apply -f mutating_policy.yaml