According to EKS best practices, the `aws-node` DaemonSet is configured to use a role assigned to the EC2 instances to assign IPs to Pods. This role includes several AWS managed policies that effectively allow all Pods running on a Node to attach/detach ENIs, assign/unassign IP addresses, or pull images from ECR. Since this presents a risk to your cluster, it is recommended that you update the `aws-node` DaemonSet to use IRSA. This policy ensures that the `aws-node` DaemonSet running in the `kube-system` Namespace is not still using the `aws-node` ServiceAccount.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: require-aws-node-irsaannotations:policies.kyverno.io/title: Require aws-node DaemonSet use IRSApolicies.kyverno.io/category: AWS, EKS Best Practicespolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: DaemonSetkyverno.io/kyverno-version: 1.8.2policies.kyverno.io/minversion: 1.6.0kyverno.io/kubernetes-version: "1.24"policies.kyverno.io/description: According to EKS best practices, the `aws-node` DaemonSet is configured to use a role assigned to the EC2 instances to assign IPs to Pods. This role includes several AWS managed policies that effectively allow all Pods running on a Node to attach/detach ENIs, assign/unassign IP addresses, or pull images from ECR. Since this presents a risk to your cluster, it is recommended that you update the `aws-node` DaemonSet to use IRSA. This policy ensures that the `aws-node` DaemonSet running in the `kube-system` Namespace is not still using the `aws-node` ServiceAccount.spec:validationFailureAction: Auditbackground: truerules:- name: validate-node-daemonset-irsamatch:any:- resources:kinds:- DaemonSetnames:- aws-nodenamespaces:- kube-systemvalidate:message: Update the aws-node daemonset to use IRSA.pattern:spec:template:spec:serviceAccountName: "!aws-node"
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.