Skip to content

Instantly share code, notes, and snippets.

View ShubhanjanMedhi-dev's full-sized avatar

Shubhanjan Medhi ShubhanjanMedhi-dev

View GitHub Profile
$ kubectl apply -f mutating_policy.yaml
$ kubectl create deployment mutate-test --image=nginx
$ kubectl get deploy --show-labels
$ kubectl -n kyverno logs -l app.kubernetes.io/component=kyverno
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: add-namespace-limit
spec:
rules:
- name: namespace-limit
match:
resources:
kinds:
$ kubectl apply -f generating_policy.yaml
$ kubectl create namespace development
$ kubectl -n development describe limitrange
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: default
name: pod-reader
rules:
- apiGroups: [""] # "" indicates the core API group
resources: ["pods"]
verbs: ["get", "watch", "list"]
apiVersion: rbac.authorization.k8s.io/v1
namespace.
kind: RoleBinding
metadata:
name: read-pods
namespace: default
subjects:
- kind: User
name: jane
apiGroup: rbac.authorization.k8s.io