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 containers named `nginx` in Pods starting with name `myapp-maintenance`.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: deny-exec-by-pod-and-containerannotations:policies.kyverno.io/title: Block Pod Exec by Pod and Containerpolicies.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 containers named `nginx` in Pods starting with name `myapp-maintenance`.spec:validationFailureAction: Enforcebackground: falserules:- name: deny-nginx-exec-in-myapp-maintenancematch:any:- resources:kinds:- Pod/execpreconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: Equalsvalue: CONNECT- key: "{{ request.name }}"operator: Equalsvalue: myapp-maintenance*validate:message: Nginx containers inside myapp-maintanence Pods may not be exec'd into.deny:conditions:all:- key: "{{ request.object.container }}"operator: Equalsvalue: nginx
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.