'MountVolume.SetUp failed for volume "webhook-cert" : secret "ingress-nginx-admission" not found

I want to install nginx-controller in my Kubernetes cluster. I setup my master node at one server, and worker node at another server. I am using Ubuntu 20.04.

I followed the link (https://github.com/kubernetes/ingress-nginx/blob/main/deploy/static/provider/cloud/1.23/deploy.yaml) and use 'kubectl apply -f file_name.yaml' to install the controller.

When I get the pods, it showed:

ubuntu@masternode:~/hello_deploy$ kubectl get pod -n ingress-nginx
NAME                                        READY   STATUS              RESTARTS   AGE
ingress-nginx-admission-create-lrzll        1/1     Running             0          27s
ingress-nginx-admission-patch-x46xh         1/1     Running             0          27s
ingress-nginx-controller-7575567f98-s9968   0/1     ContainerCreating   0          27s

However, when I checked the pod, it showed:

Events:
  Type     Reason       Age                  From               Message
  ----     ------       ----                 ----               -------
  Normal   Scheduled    14m                  default-scheduler  Successfully assigned ingress-nginx/ingress-nginx-controller-7575567f98-s9968 to workernode
  Warning  FailedMount  109s (x14 over 14m)  kubelet            MountVolume.SetUp failed for volume "webhook-cert" : secret "ingress-nginx-admission" not found
  Warning  FailedMount  45s (x6 over 12m)    kubelet            Unable to attach or mount volumes: unmounted volumes=[webhook-cert], unattached volumes=[webhook-cert kube-api-access-n2xrb]: timed out waiting for the condition

There is another error message I saw also:

Unable to attach or mount volumes: unmounted volumes=[webhook-cert], unattached volumes=[webhook-cert kube-api-access-n2xrb]: timed out waiting for the condition

Can anyone tell me what is the reason for this to happen? Any method/ setting to solve these problems?

Thanks.



Solution 1:[1]

Hello, hope you are enjoying your Kubernetes journey,

I deployed the manifest from https://github.com/kubernetes/ingress-nginx/blob/main/deploy/static/provider/cloud/1.23/deploy.yaml and it worked well for me. (I am using a kind (kubernetes in docker) cluster).

However a lot of people seems to get the same issue (cf here https://github.com/kubernetes/ingress-nginx/issues/5932)

in the above link (github issue 5932), people have solved their problems either by:

  • Restarting the Docker engine of the machine where Webhook is located (maybe because of a problem with docker's network bridge)
  • Modifying "--ingress-class=nginx" to "--ingress-class=nginx2" in apply.yaml file so it was because there was an ingress class with the same name "nginx"
  • Trying it to another cluster (managed EKS, GKE, or if its tests you can use minikube or kind as I am)

Hope this will solve your problem, (you can also check your volume provisioner configuration ? )

Bguess.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bguess