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 to Pods beginning with the name `myapp-maintenance-`.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: deny-exec-by-pod-nameannotations:policies.kyverno.io/title: Block Pod Exec by Pod Namepolicies.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 to Pods beginning with the name `myapp-maintenance-`.spec:validationFailureAction: Enforcebackground: falserules:- name: deny-exec-myapp-maintenancematch:any:- resources:kinds:- Pod/execpreconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: Equalsvalue: CONNECTvalidate:message: Exec'ing into Pods called "myapp-maintenance" is not allowed.deny:conditions:all:- key: "{{ request.name }}"operator: Equalsvalue: myapp-maintenance-*
This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.
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.