2

How do I expose an ingress when running kubernetes with minikube in windows 10?

I have enabled the minikube ingress add on.

My ingress is running here...

NAME               CLASS   HOSTS           ADDRESS        PORTS   AGE
helmtest-ingress   nginx   helmtest.info   192.168.49.2   80      37m

I have added my hosts entry...

192.168.49.2 helmtest.info

I just get nothing when attempting to browse or ping either 192.168.49.2 or helmtest.info

My ingress looks like the following

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: helmtest-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - host: helmtest.info
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: helmtest-service
                port:
                  number: 80

My service looks like the following...

apiVersion: v1
kind: Service
metadata:
  name: helmtest-service
  labels: 
    app: helmtest-service
spec:
  type: ClusterIP
  selector:
    app: helmtest
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP

I can access my service successfully in the browser after running minikube service helmtest-service --url

If I run minikube tunnel it just hangs here....

minikube tunnel
❗  Access to ports below 1024 may fail on Windows with OpenSSH clients older than v8.1. For more information, see: https://minikube.sigs.k8s.io/docs/handbook/accessing/#access-to-ports-1024-on-windows-requires-root-permission
  Starting tunnel for service helmtest-ingress.

Where am I going wrong here?

Konzy262
  • 2,747
  • 6
  • 42
  • 71
  • Please provide more details about your env. Just to confirm, you are using Minikube on Windows 10, not any Virtualization software like (VMVare or Virtual box)? How did you install the minikube and which version? Did you start Minikube (which container/virtual manager)? Like mentioned [here](https://minikube.sigs.k8s.io/docs/start/) or did you use `Docker Desktop for Windows`? Also in your error message, you have info that you might use outdated version of SSH like mentioned [here](https://minikube.sigs.k8s.io/docs/handbook/accessing/#access-to-ports-1024-on-windows-requires-root-permission). – PjoterS Nov 15 '21 at 12:30
  • Did you try to update it using `choco install openssh`? I can see that you have the message `Starting tunnel for service helmtest-ingress.` Is there anything further? When you are using minikube tunnel you need to have 2 SSH connections, it's mentioned [here](https://minikube.sigs.k8s.io/docs/handbook/accessing/#using-minikube-tunnel) `It must be run in a separate terminal window to keep the LoadBalancer running.` Also which addons did you turn on for Ingress? Did you enabel also `ingress-dns` addon? What you will get when you will run `kubectl get svc -A`? – PjoterS Nov 15 '21 at 12:31

2 Answers2

1

OP didn't provide further information so I will provide answer based on the current information.

You can run Ingress on Minikube using the $ minikube addons enable ingress command. However, ingress has more addons, like Ingress DNS using minikube addons enabled ingress-dns. In Minikube documentation you can find more details about this addon and when you should use it.

Minikube has quite a well described section about tunnel. Quite important fact about the tunnel is that it must be run in a separate terminal window to keep the LoadBalancer running.

Services of type LoadBalancer can be exposed via the minikube tunnel command. It must be run in a separate terminal window to keep the LoadBalancer running. Ctrl-C in the terminal can be used to terminate the process at which time the network routes will be cleaned up.

This part is described in Accessing apps documentation.

As OP mention

I can access my service successfully in the browser after running minikube service helmtest-service --url

If I run minikube tunnel it just hangs here....

Possible Solution

  • You might use the old version of SSH, update it.
  • You are using ports <1024. This situation it's described in this known issue part. Try to use higher port like 5000 like in this example
  • It might look like it just hangs, but you need a separate terminal window. Maybe it works correctly but you have to use another terminal

Useful links

PjoterS
  • 12,841
  • 1
  • 22
  • 54
0

It might be the host file missing minikube ip address with your host name. If ingress cannot resolve the hostname you set in yaml file it just stays in the schedule to sync phase

Similar answer