The `exec` command may be used to gain shell access, or run other commands, in a Pod's container. While this can be useful for troubleshooting purposes, it could represent an attack vector and is discouraged. This policy blocks Pod exec commands based upon a Namespace label `exec=false`.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: deny-exec-by-namespace-labelannotations:policies.kyverno.io/title: Block Pod Exec by Namespace Labelpolicies.kyverno.io/category: Samplepolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/subject: Podpolicies.kyverno.io/description: The `exec` command may be used to gain shell access, or run other commands, in a Pod's container. While this can be useful for troubleshooting purposes, it could represent an attack vector and is discouraged. This policy blocks Pod exec commands based upon a Namespace label `exec=false`.spec:validationFailureAction: Enforcebackground: falserules:- name: deny-exec-by-ns-labelmatch:any:- resources:kinds:- Pod/execcontext:- name: nslabelexecapiCall:urlPath: /api/v1/namespaces/{{request.namespace}}jmesPath: metadata.labels.exec || ''preconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: Equalsvalue: CONNECTvalidate:message: Executing a command in a container is forbidden for Pods running in Namespaces protected with the label "exec=false".deny:conditions:any:- key: "{{ nslabelexec }}"operator: Equalsvalue: "false"
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.
This policy ensures that the name of the ApplicationSet is the same value provided in the project.