The kubectl cp command is used to copy files between a local machine and a Pod's container. While this functionality is useful for transferring data, it may introduce security risks, such as unauthorized data exfiltration or modification. This policy blocks the use of the kubectl cp command on all Pods with label `block-kubectl-cp=true`, ensuring that sensitive workloads are protected from unintended file transfers. Other kubectl operations are unaffected, allowing for normal Pod management while preventing potential misuse of file copy capabilities.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: block-kubectl-cp-by-pod-labelannotations:policies.kyverno.io/title: Block kubectl cp command by Pod Labelpolicies.kyverno.io/category: Samplepolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/subject: Podpolicies.kyverno.io/description: The kubectl cp command is used to copy files between a local machine and a Pod's container. While this functionality is useful for transferring data, it may introduce security risks, such as unauthorized data exfiltration or modification. This policy blocks the use of the kubectl cp command on all Pods with label `block-kubectl-cp=true`, ensuring that sensitive workloads are protected from unintended file transfers. Other kubectl operations are unaffected, allowing for normal Pod management while preventing potential misuse of file copy capabilities.spec:validationFailureAction: Enforcebackground: falserules:- name: block-kubectl-cpmatch:any:- resources:kinds:- Pod/execpreconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: Equalsvalue: CONNECTvalidate:message: Cannot use `kubectl cp` on podsdeny:conditions:all:- key: "{{ request.object.command[0] }}"operator: Equalsvalue: tar- key: "{{ request.object.command[1] }}"operator: Equalsvalue: cf
This policy prevents the use of the default project in an Application.
Services of type LoadBalancer when deployed inside AWS have support for transport encryption if it is enabled via an annotation. This policy requires that Services of type LoadBalancer contain the annotation service.beta.kubernetes.io/aws-load-balancer-ssl-cert with some value.
This policy prevents updates to the project field after an Application is created.