1

I tried to setup a simple minikube cluster with ingress.

After following this tutorial: https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/

my actions:

  • minkube start
  • minikube addons enable ingress
  • kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0
  • kubectl expose deployment web --type=NodePort --port=8080
  • kubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml
  • add entry to hosts file

I'm unable to curl hello-world.info from PowerShell (also I'm unable to curl $(minikube ip) if no host is specified in .yaml file), but it works from inside docker container cli:

# curl hello-world.info
Hello, world!
Version: 1.0.0
Hostname: web-79d88c97d6-pw565

Am I right thinking that docker is not forwarding my request to the minikube container?

Docker inspect tab:

Environment
CONTAINER
docker

PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Mounts
/VAR
/var/lib/docker/volumes/minikube/_data

/LIB/MODULES
/lib/modules

Ports
22/tcp
127.0.0.1:0

2376/tcp
127.0.0.1:0

32443/tcp
127.0.0.1:0

5000/tcp
127.0.0.1:0

8443/tcp
127.0.0.1:0

ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - host: hello-world.info
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: web
                port:
                  number: 8080
PS D:\> kubectl get ing
NAME              CLASS    HOSTS              ADDRESS        PORTS   AGE
example-ingress   <none>   hello-world.info   192.168.49.2   80      22m
minikube version: v1.18.1
minikube docker image: gcr.io/k8s-minikube/kicbase  v0.0.18
system: Windows 10

edit

I also tried to create a NodePort type service on clean minikube so I could access it with cluserIP:servicePort but same thing happens. I can access it on minikube after doing minikube ssh (IP:servicePort or 127.0.0.1:servicePort) so the service works just fine, but I'm unable to curl it from outside of docker.

edit2

Now I tried some forwarding. the below command allows me to access the 'web' service on 127.0.0.1:8080

PS D:\> kubectl port-forward service/web 8080
Forwarding from 127.0.0.1:8080 -> 8080

I suppose its similar to doing minikube service web, but this can't be done for ingress.

minikube tunnel seams to do nothing for me

edit3

I can verify that the ingress is working by creating 2 services:

kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0
kubectl expose deployment web --type=NodePort --port=8080

kubectl create deployment web2 --image=gcr.io/google-samples/hello-app:1.0
kubectl expose deployment web2 --type=NodePort --port=8080

and point path to it - ingress.yaml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - http:
        paths:
          - path: /web1
            pathType: Prefix
            backend:
              service:
                name: web
                port:
                  number: 8080
          - path: /web2
            pathType: Prefix
            backend:
              service:
                name: web2
                port:
                  number: 8080

docker cli:

# curl 127.0.0.1/web2
Hello, world!
Version: 1.0.0
Hostname: web2-5b669f8984-5tgpn
# curl 127.0.0.1/web1
Hello, world!
Version: 1.0.0
Hostname: web-79d88c97d6-8h6dq

By looking at the hostnames you can see that different pods respond. But I still can't access the ingress from outside of docker

Vit
  • 7,740
  • 15
  • 40
Piotr Kolecki
  • 360
  • 1
  • 10
  • similar problem is described here: https://stackoverflow.com/questions/66275458/could-not-access-kubernetes-ingress-in-browser-on-windows-home-with-minikube – Piotr Kolecki Mar 18 '21 at 08:07
  • 1
    How do you expect windows to resolve: `hello-world.info`? Have you put an entry in your hosts file that maps that to an IP address, or are you running a local dns service that you've pointed windows at? (note: these are rhetorical questions) – Software Engineer Mar 18 '21 at 08:38
  • `minikube addons enable ingress`? –  Mar 18 '21 at 08:38
  • @SoftwareEngineer I have indeed put the entry there, it can be resolved from inside docker cli. – Piotr Kolecki Mar 18 '21 at 08:49
  • @full_steak_developer i did that and can verify that ingress is working. I will add that as an edit3 – Piotr Kolecki Mar 18 '21 at 08:57
  • 1
    I also tried to run minikube on virtualBox. This time it worked as expected - I am able to access the services via ingress with cluster IP. – Piotr Kolecki Mar 18 '21 at 11:12
  • @PiotrKolecki How you run Minikube using virtualbox? It conflicts with Hyper V. Will Disabling HyperV disable Docker Desktop on Windows? – Mikhail_Sam Dec 13 '21 at 14:35

1 Answers1

0

I face the same problem and didn't find the solution for Docker driver. But I find the information that Minikube still doesn't support full Ingress functionality for Docker driver: https://minikube.sigs.k8s.io/docs/drivers/docker/#known-issues

The ingress, and ingress-dns addons are currently only supported on Linux. See #7332

So using virtualbox driver sounds like a possible solution. (I'm trying it right now, but you wrote it should works).

Mikhail_Sam
  • 10,602
  • 11
  • 66
  • 102