Problem with host, with minikube + nginx ingress

marko streleshki
apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auth
  template:
    metadata:
      labels:
        app: auth
    spec:
      containers:
        - name: auth
          image: emotive44/auth
          env:
            - name: JWT_KEY
              valueFrom:
                secretKeyRef:
                  name: jwt-secret
                  key: JWT_KEY
---
apiVersion: v1
kind: Service
metadata:
  name: auth-srv
spec:
  type: NodePort
  selector:
    app: auth
  ports:
    - name: auth
      protocol: TCP
      port: 3000
      targetPort: 3000
      nodePort: 30000

This is my auth service and deployment.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
  rules:
    - host: myapp.com
      http:
        paths:
          - path: /api/users/?(.*)
            pathType: "Prefix"
            backend:
              service:
                name: auth-srv
                port:
                  number: 3000

That is my Ingress file.

When I run commnand: minikube start, the message, which I received is:

StartHost failed, but will try again: provision: get ssh host-port: get port 22 for "minikube": docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube: exit status 1

kubectl get ingress, returns:

NAME             CLASS     HOSTS     ADDRESS          PORTS  AGE 
ingress-service  <none>   myapp.com  192.168.49.2      80     106m

In my windows host file I add: 192.168.49.2 myapp.com

And if I try to open myapp.com in browser: There is no access to this site

curl myapp.com

curl: (7) Failed to connect to myapp.com port 80: Timed out

This is describe for my ingress:

Name:             ingress-service
Namespace:        default
Address:          192.168.49.2
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host        Path  Backends
  ----        ----  --------
  myapp.com
              /api/users/?(.*)   auth-srv:3000 (172.17.0.2:3000)
Annotations:  kubernetes.io/ingress.class: nginx
              nginx.ingress.kubernetes.io/use-regex: true

What could be the problem?

Wytrzymały Wiktor

The known issues of docker driver for minikube says:

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

It also applies to Windows:

$ minikube addons enable ingress
* Due to docker networking limitations on windows, ingress addon is not supported for this driver.
Alternatively to use this addon you can use a vm-based driver:

        'minikube start --vm=true'

To track the update on this work in progress feature please check:
https://github.com/kubernetes/minikube/issues/7332

The solution for this is to use the hyperv driver:

Hyper-V is a native hypervisor built in to modern versions of Microsoft Windows.

Recreating your minikube cluster with --driver=hyperv flag will fix your issue.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

minikube and ingress-nginx does not have port 80 open

Nginx Ingress Controller: What is the purpose of the host variable?

Nginx ingress host 404 ip found

AKS Ingress-Nginx ingress controller failing to route by host

Problem with Ingress when following documentation steps using the NGINX Ingress Controller

Another nginx ingress rewrite-target problem

ingress-nginx - create one ingress per host? Or combine many hosts into one ingress and reload?

create ingress deployment with minikube

Minikube Ingress shows 404

Minikube with ingress example not working

Reference nginx-ingress host name to internal service

NGINX controller Kubernetes: need to change Host header within ingress

Unable to add multiple Ingresses with same host on nginx-ingress

How to add blocking IP rules on each nginx-ingress host

My test web app is showing up error, I am using nginx in Dockerfile - ingress in kubernetes minikube

Why does nginx ingress minikube plugin hostPort work but hostPort does not work for any other plugin?

Minikube with Ingress local image configuration

nginx ingress: conflicting host in yaml definition ignored in nginx-controller log, but creating non working situation

minikube + nginx + volumeMount not working

'host' field in kubernetes ingress

Ingress rule using host

Can I get response of curl through POD IP address (instead of host address) while using nginx ingress

terraform fails to create ingress while using minikube

minikube ingress insisting on HTTPS despite TLS not configured

Kubernetes / Minikube Ingress error (301 Moved Permanently)

Cannot route traffic with Minikube + ingress + Django

Minikube Kubernetes Ingress create always throws errors

Is Ingress useable only for Minikube? It is not working in Ubuntu installation

Minikube: Are there any ways for driver=none to use ingress