title: Nginx Ingress Controller - Failed Calling Webhook
body: <p>I set up a k8s cluster using kubeadm (v1.18) on an Ubuntu virtual machine.
  Now I need to add an Ingress Controller. I decided for nginx (but I'm open for other solutions). I installed it according to the <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="noreferrer">docs</a>, section "bare-metal":</p>
  
  <p><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-0.31.1/deploy/static/provider/baremetal/deploy.yaml</code></p>
  
  <p>The installation seems fine to me:</p>
  
  <p><code>kubectl get all -n ingress-nginx</code></p>
  
  <pre><code>NAME                                            READY   STATUS      RESTARTS   AGE
  pod/ingress-nginx-admission-create-b8smg        0/1     Completed   0          8m21s
  pod/ingress-nginx-admission-patch-6nbjb         0/1     Completed   1          8m21s
  pod/ingress-nginx-controller-78f6c57f64-m89n8   1/1     Running     0          8m31s
  
  NAME                                         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
  service/ingress-nginx-controller             NodePort    10.107.152.204   &lt;none&gt;        80:32367/TCP,443:31480/TCP   8m31s
  service/ingress-nginx-controller-admission   ClusterIP   10.110.191.169   &lt;none&gt;        443/TCP                      8m31s
  
  NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
  deployment.apps/ingress-nginx-controller   1/1     1            1           8m31s
  
  NAME                                                  DESIRED   CURRENT   READY   AGE
  replicaset.apps/ingress-nginx-controller-78f6c57f64   1         1         1       8m31s
  
  NAME                                       COMPLETIONS   DURATION   AGE
  job.batch/ingress-nginx-admission-create   1/1           2s         8m31s
  job.batch/ingress-nginx-admission-patch    1/1           3s         8m31s
  </code></pre>
  
  <p>However, when trying to apply a custom Ingress, I get the following error:</p>
  
  <p><code>Error from server (InternalError): error when creating "yaml/xxx/xxx-ingress.yaml": Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": Post https://ingress-nginx-controller-admission.ingress-nginx.svc:443/extensions/v1beta1/ingresses?timeout=30s: Temporary Redirect</code></p>
  
  <p>Any idea what could be wrong?</p>
  
  <p>I suspected DNS, but other NodePort services are working as expected and DNS works within the cluster.</p>
  
  <p>The only thing I can see is that I don't have a default-http-backend which is mentioned in the <a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#over-a-nodeport-service" rel="noreferrer">docs here</a>. However, this seems normal in my case, according to <a href="https://github.com/kubernetes/kubeadm/issues/680#issuecomment-365524769" rel="noreferrer">this thread</a>.</p>
  
  <p>Last but not least, I tried as well the <a href="https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/" rel="noreferrer">installation with manifests</a> (after removing ingress-nginx namespace from previous installation) and the <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="noreferrer">installation via Helm chart</a>. It has the same result.</p>
  
  <p>I'm pretty much a beginner on k8s and this is my playground-cluster. So I'm open to alternative solutions as well, as long as I don't need to set up the whole cluster from scratch.</p>
  
  <p><strong>Update:</strong>
  With "applying custom Ingress", I mean:
  <code>kubectl apply -f &lt;myIngress.yaml&gt;</code></p>
  
  <p>Content of myIngress.yaml</p>
  
  <pre><code>apiVersion: networking.k8s.io/v1beta1
  kind: Ingress
  metadata:
    name: my-ingress
    annotations:
      nginx.ingress.kubernetes.io/rewrite-target: /
  spec:
    rules:
    - http:
        paths:
        - path: /someroute/fittingmyneeds
          pathType: Prefix
          backend:
            serviceName: some-service
            servicePort: 5000
  </code></pre>