<p>I'm creating my Kubernetes single node cluster using kubeadm. After applying the ingress ngnix controller, I'm getting the following error when I try to apply the ingress file.</p>
<p>I'm getting the following error while applying the ingress:</p>
<p><code>Error from server (InternalError): error when creating &quot;ingress.yaml&quot;: Internal error occurred: failed calling webhook &quot;validate.nginx.ingress.kubernetes.io&quot;: Post &quot;https://ingress-nginx-controller-admission.ingress-nginx.svc:443/networking/v1/ingresses?timeout=10s&quot;: dial tcp 10.101.247.233:443: connect: connection refused</code></p>
<p>I'm currently using the ingress nginx controller. How can I resolve this issue?</p>

nimramubashir
<p>This usually happens because there is a problem in the configuration of the ValidatingWebhookConfiguration. When you deploy the nginx controller it deploys multiple resources, one of those is this validation, which function is to validate all the ingress that you create later on. Sometimes it might happen that there is a communication problem and you get that error even having the correct structure for the ingress.</p>
<p>My recommendations:</p>
<ul>
<li>Check if the structure of your ingress is correct</li>
<li>Backup the current validation and delete it, check if the problem is solved (even though this might not be the best solution for sure it will work)
You can achieve this by doing:</li>
</ul>
<pre><code>    kubectl get ValidatingWebhookConfiguration -o yaml &gt; ./validating-backup.yaml

    kubectl delete ValidatingWebhookConfiguration &lt;name of the resource&gt;
</code></pre>
<p><strong>be carefull since the ValidatingWebhookConfiguration  is cluster wide</strong></p>
<p>Finally, if you want to keep the ValidatingWebhookConfiguration, the best option might to redeploy the whole Ingress Controller using helm, so you ensure it gets correctly deployed. Here is they why that validation is used: <a href="https://kubernetes.github.io/ingress-nginx/how-it-works/#avoiding-outage-from-wrong-configuration" rel="nofollow noreferrer">link</a></p>
<p>Sources:</p>
<ul>
<li><p>Personal experience</p>
</li>
<li><p><a href="https://github.com/kubernetes/ingress-nginx/issues/5401" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx/issues/5401</a></p>
</li>
<li><p><a href="https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/</a></p>
</li>
</ul>
