Open anuragjain08 opened 2 months ago
Thanks for opening your first issue here! Be sure to follow the issue template!
Could someone please help here as this is completely blocking me from using kyverno in EKS Clusters.
Have you read this https://kyverno.io/docs/troubleshooting/#kyverno-fails-on-eks?
Thanks for sharing this @realshuting Missed this one - but seems like my cluster has all the required config
So, what else should I check in this case or am I missing something here? @realshuting
Have you verified this?
$ kubectl run busybox --rm -ti --image=busybox -- /bin/sh
If you don't see a command prompt, try pressing enter.
/ # wget --no-check-certificate --spider --timeout=1 [https://kyverno-svc.kyverno.svc:443/health/liveness](https://kyverno-svc.kyverno.svc/health/liveness)
Connecting to kyverno-svc.kyverno.svc:443 (100.67.141.176:443)
remote file exists
/ # exit
Session ended, resume using 'kubectl attach busybox -c busybox -i -t' command when the pod is running
pod "busybox" deleted
@realshuting I am getting TLS handshake error
kubectl run busybox --rm -ti --image=busybox -- /bin/sh If you don't see a command prompt, try pressing enter. / # / # / # wget --no-check-certificate --spider --timeout=1 https://kyverno-svc.kyverno.svc:443/health/liveness Connecting to kyverno-svc.kyverno.svc:443 (10.100.229.190:443) wget: TLS error from peer (alert code 40): handshake failure wget: error getting response: Connection reset by peer
Also I can see :
kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations | grep kyverno mutatingwebhookconfiguration.admissionregistration.k8s.io/kyverno-resource-mutating-webhook-cfg 0 6d21h
Also there is a timing mismatch between the pod creation time and web-hook creation timing.
But I am bit struggling to understand how this will block from nodes to come up inc case complete cluster is going down?
Hi @realshuting , is there anything else which I am missing here or could take a look and sort this out ? Thank you.
Hi @anuragjain08 - there's something blocking the connection, you need to check if there's any firewall rules / networkpolicy set for your cluster.
Until the connection issue is addressed, you can enable the Ignore
failurePolicy (see this Helm option) to bypass failed requests.
Kyverno Version
1.12.5
Kubernetes Version
1.29.x
Kubernetes Platform
EKS
Kyverno Rule Type
Validate
Description
Installed kyverno via helm chart version 3.2.6 and kyverno version 1.12.5. By default via config map and webhooks, kube-system namespace was excluded from admission controller and kyverno namespace was excluded because of this excludeKyvernoNamespace. Kyverno got installed properly. I also installed policy-reporter-ui in the kyverno namespace only via helm chart. This was also working as expected. I applied below three policies in the audit mode, as below.
apiVersion: kyverno.io/v1 kind: ClusterPolicy metadata: name: restrict-annotations-kube2iam annotations: policies.kyverno.io/title: Restrict Annotations policies.kyverno.io/category: Annotation policies.kyverno.io/subject: Pod, Annotation policies.kyverno.io/description: >- This policy prevents the use of an annotation beginning with
iam.amazonaws.com/role`. This can be useful to ensure users either don't set reserved annotations or to force them to use a newer version of an annotation. spec: validationFailureAction: audit background: true rules:`apiVersion: kyverno.io/v1 kind: ClusterPolicy metadata: name: require-labels annotations: policies.kyverno.io/title: Require Labels policies.kyverno.io/category: Best Practices policies.kyverno.io/subject: Pod, Label policies.kyverno.io/description: >- Define and use labels that identify semantic attributes of your application or Deployment. A common set of labels allows tools to work collaboratively, describing objects in a common manner that all tools can understand. The recommended labels describe applications in a way that can be queried. This policy validates that the below labels are specified with some value.
spec: validationFailureAction: audit background: true rules:
3.
`apiVersion: kyverno.io/v1 kind: ClusterPolicy metadata: name: restrict-image-registries annotations: policies.kyverno.io/title: Restrict Image Registries policies.kyverno.io/category: Best Practices, EKS Best Practices policies.kyverno.io/subject: Pod policies.kyverno.io/description: >- Images from unknown, public registries can be of dubious quality and may not be scanned and secured, representing a high degree of risk. Requiring use of known, approved registries helps reduce threat exposure by ensuring image pulls only come from them. This policy validates that container images only originate from the private ecr registry.
spec: validationFailureAction: audit background: true rules:
Then to test kyverno doesn't interfere with kube-system namespace, I brought down all the worker nodes of the EKS cluster and when the autoscaler brought new instances into the system, they were not in the ready state.
Steps to reproduce
Expected behavior
Data defaultRegistry: docker.io enableDefaultRegistryMutation: true excludeGroups: system:nodes generateSuccessEvents: false resourceFilters: [/,kyverno,] [Event,,] [/,kube-system,] [/,kube-public,] [/,kube-node-lease,] [Node,,] [Node/,,] [APIService,,] [APIService/,,] [TokenReview,,] [SubjectAccessReview,,] [SelfSubjectAccessReview,,] [Binding,,] [Pod/binding,,] [ReplicaSet,,] [ReplicaSet/,,] [AdmissionReport,,] [AdmissionReport/,,] [ClusterAdmissionReport,,] [ClusterAdmissionReport/,,] [BackgroundScanReport,,] [BackgroundScanReport/,,] [ClusterBackgroundScanReport,,] [ClusterBackgroundScanReport/,,] [ClusterRole,,kyverno:admission-controller] [ClusterRole,,kyverno:admission-controller:core] [ClusterRole,,kyverno:admission-controller:additional] [ClusterRole,,kyverno:background-controller] [ClusterRole,,kyverno:background-controller:core] [ClusterRole,,kyverno:background-controller:additional] [ClusterRole,,kyverno:cleanup-controller] [ClusterRole,,kyverno:cleanup-controller:core] [ClusterRole,,kyverno:cleanup-controller:additional] [ClusterRole,,kyverno:reports-controller] [ClusterRole,,kyverno:reports-controller:core] [ClusterRole,,kyverno:reports-controller:additional] [ClusterRoleBinding,,kyverno:admission-controller] [ClusterRoleBinding,,kyverno:background-controller] [ClusterRoleBinding,,kyverno:cleanup-controller] [ClusterRoleBinding,,kyverno:reports-controller] [ServiceAccount,kyverno,kyverno-admission-controller] [ServiceAccount/,kyverno,kyverno-admission-controller] [ServiceAccount,kyverno,kyverno-background-controller] [ServiceAccount/,kyverno,kyverno-background-controller] [ServiceAccount,kyverno,kyverno-cleanup-controller] [ServiceAccount/,kyverno,kyverno-cleanup-controller] [ServiceAccount,kyverno,kyverno-reports-controller] [ServiceAccount/,kyverno,kyverno-reports-controller] [Role,kyverno,kyverno:admission-controller] [Role,kyverno,kyverno:background-controller] [Role,kyverno,kyverno:cleanup-controller] [Role,kyverno,kyverno:reports-controller] [RoleBinding,kyverno,kyverno:admission-controller] [RoleBinding,kyverno,kyverno:background-controller] [RoleBinding,kyverno,kyverno:cleanup-controller] [RoleBinding,kyverno,kyverno:reports-controller] [ConfigMap,kyverno,kyverno] [ConfigMap,kyverno,kyverno-metrics] [Deployment,kyverno,kyverno-admission-controller] [Deployment/,kyverno,kyverno-admission-controller] [Deployment,kyverno,kyverno-background-controller] [Deployment/,kyverno,kyverno-background-controller] [Deployment,kyverno,kyverno-cleanup-controller] [Deployment/,kyverno,kyverno-cleanup-controller] [Deployment,kyverno,kyverno-reports-controller] [Deployment/,kyverno,kyverno-reports-controller] [Pod,kyverno,kyverno-admission-controller-] [Pod/,kyverno,kyverno-admission-controller-] [Pod,kyverno,kyverno-background-controller-] [Pod/,kyverno,kyverno-background-controller-] [Pod,kyverno,kyverno-cleanup-controller-] [Pod/,kyverno,kyverno-cleanup-controller-] [Pod,kyverno,kyverno-reports-controller-] [Pod/,kyverno,kyverno-reports-controller-] [Job,kyverno,kyverno-hook-pre-delete] [Job/,kyverno,kyverno-hook-pre-delete] [NetworkPolicy,kyverno,kyverno-admission-controller] [NetworkPolicy/,kyverno,kyverno-admission-controller] [NetworkPolicy,kyverno,kyverno-background-controller] [NetworkPolicy/,kyverno,kyverno-background-controller] [NetworkPolicy,kyverno,kyverno-cleanup-controller] [NetworkPolicy/,kyverno,kyverno-cleanup-controller] [NetworkPolicy,kyverno,kyverno-reports-controller] [NetworkPolicy/,kyverno,kyverno-reports-controller] [PodDisruptionBudget,kyverno,kyverno-admission-controller] [PodDisruptionBudget/,kyverno,kyverno-admission-controller] [PodDisruptionBudget,kyverno,kyverno-background-controller] [PodDisruptionBudget/,kyverno,kyverno-background-controller] [PodDisruptionBudget,kyverno,kyverno-cleanup-controller] [PodDisruptionBudget/,kyverno,kyverno-cleanup-controller] [PodDisruptionBudget,kyverno,kyverno-reports-controller] [PodDisruptionBudget/,kyverno,kyverno-reports-controller] [Service,kyverno,kyverno-svc] [Service/,kyverno,kyverno-svc] [Service,kyverno,kyverno-svc-metrics] [Service/,kyverno,kyverno-svc-metrics] [Service,kyverno,kyverno-background-controller-metrics] [Service/,kyverno,kyverno-background-controller-metrics] [Service,kyverno,kyverno-cleanup-controller] [Service/,kyverno,kyverno-cleanup-controller] [Service,kyverno,kyverno-cleanup-controller-metrics] [Service/,kyverno,kyverno-cleanup-controller-metrics] [Service,kyverno,kyverno-reports-controller-metrics] [Service/,kyverno,kyverno-reports-controller-metrics] [ServiceMonitor,kyverno,kyverno-admission-controller] [ServiceMonitor,kyverno,kyverno-background-controller] [ServiceMonitor,kyverno,kyverno-cleanup-controller] [ServiceMonitor,kyverno,kyverno-reports-controller] [Secret,kyverno,kyverno-svc.kyverno.svc.] [Secret,kyverno,kyverno-cleanup-controller.kyverno.svc.] webhookAnnotations: {"admissions.enforcer/disabled":"true"} webhooks: [{"matchExpressions":[{"key":"kubernetes.io/metadata.name","operator":"NotIn","values":["kube-system"]}],"namespaceSelector":{"matchExpressions":[{"key":"kubernetes.io/metadata.name","operator":"NotIn","values":["kyverno"]}],"matchLabels":null}}]
BinaryData Events: ``
kubectl delete validatingwebhookconfiguration kyverno-resource-validating-webhook-cfg kubectl delete mutatingwebhookconfiguration kyverno-resource-mutating-webhook-cfg
Screenshots
No response
Kyverno logs
Slack discussion
No response
Troubleshooting