2

I reset my entire Docker Desktop from factory settings and enable kubernetes. Then, I run kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.4/deploy/static/provider/cloud/deploy.yaml and wait for the ingress to be ready. Then, I deploy my application, which includes several services and an ingress definition.

The ingress is as follows:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/proxy-body-size: 100m
spec:
  ingressClassName: nginx
  rules:
  - host: test.project.com
    http:
      paths:
      - path: "/.*"
        pathType: "Prefix"
        backend:
          service:
            name: test-frontend
            port:
              number: 80

Checking on the service, I get:

NAME            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE
test-frontend   ClusterIP   10.104.106.210   <none>        80/TCP    40m

kubectl get services -n ingress-nginx returns

NAME                                 TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx-controller             LoadBalancer   10.100.44.33   <pending>     80:30753/TCP,443:31632/TCP   51m
ingress-nginx-controller-admission   ClusterIP      10.97.85.58    <none>        443/TCP                      51m

kubectl get ingresses returns

NAME           CLASS   HOSTS              ADDRESS   PORTS   AGE
test-ingress   nginx   test.project.com             80      31m

As you can see, Docker Desktop or the Ingress is not properly binding the ingress to localhost, as it usually does. What I've been doing for the last several weeks is constantly stopping, restarting, rebuilding and resetting my deployments, services, ingresses, nodes, my computer, and Docker desktop until it suddenly starts working. I have never been able to find out what actually fixes it, it seems almost random whether it works or not, and when it stops working.

The only interesting thing I can find involves the events of the test-ingress:

Events:
  Type    Reason  Age                  From                      Message
  ----    ------  ----                 ----                      -------
  Normal  Sync    35m (x3 over 42m)    nginx-ingress-controller  Scheduled for sync
  Normal  Sync    27m (x2 over 28m)    nginx-ingress-controller  Scheduled for sync
  Normal  Sync    7m55s (x2 over 14m)  nginx-ingress-controller  Scheduled for sync

Edit: It started working again after a restart of my desktop. Leaving this up for any ideas as to how to prevent this or how to fix it faster next time, as this is the 5th or 6th time this has happened.

Ral
  • 332
  • 2
  • 14
  • Which OS are you using? What Docker desktop version is installed? I only yesterday created a setup on Windows with docker desktop 4.2.0 and it takes 1 minutes to get the `localhost` address. And even now `ingress` is missing address however it works. Does your service work? Because based on my experience on Windows this address is not accurate. I used `minikube` with `hyperv` driver and still yet it was `localhost` but in fact it was a VM address. – moonkotte Nov 19 '21 at 09:26
  • Windows 10 with Docker Desktop 4.2.0. I can leave the setup for upwards of an hour with no host assignment. The service does work, I can see the HTTP readiness checks going through and returning 200. – Ral Nov 19 '21 at 16:08
  • Does `ingress` work? Can you hit the domain? Trying to understand if the issue is only that address is not shown or it doesn't work completely. Also WSL2 is used or hyper-v? – moonkotte Nov 22 '21 at 08:51

1 Answers1

2

may be try

kubectl expose deployment test-ingress-deployment --type=NodePort --port=8080 --name=test-ingress-service -n demo --dry-run=1 -o yaml > mypod-service.yaml

to get the yaml template generate for the service

then start the service by apply that yaml file

then apply the ingress yaml file

on Window 10 and that will assign a random port 9999 that can be access from the "minikube ip":9999/* url

the host name is not really set but in the host file. Ingress can be access via the ip. Ingress is end point access to multiple services regardless of namespaces but the service have to be exposed directly.

if the host file is not update with the minikube ip and the host name then ingress is Scheduled for sync.

it should work with Hyper VM

https://local/hello

Koedlt
  • 4,286
  • 8
  • 15
  • 33