Search code examples
dockerkuberneteskubernetes-ingressminikube

Minikube Ingress Controller (with custom domain) Not Loading


I'm trying to run a VueJS app on my local machine with minikube and Kubernetes.

Now,

  1. I applied the YAML file.
  2. Added the IP address of the ingress to /etc/hosts on my MacOS (M1).

neu.com does not load, nor does the IP address of the ingress controller.

What I've tried

  1. Tried running the service with a nodeport (it loads up fine)
  2. Removing everything, and doing the whole thing from start

(minikube addon ingress is switched on)

Here is the version info for all the tools I'm using.

kubectl version --short

Client Version: v1.24.3
Kustomize Version: v4.5.4
Server Version: v1.24.1
-------------------------
minikube version
minikube version: v1.26.0
commit: f4b412861bb746be73053c9f6d2895f12cf78565

And this is the YAML file.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cleo
  labels:
    app: cleo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cleo
  template:
    metadata:
      labels:
        app: cleo
    spec:
      containers:
      - name: cleo
        image: image-name-of-my-vuejs-app 
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: cleo-service
spec:
  selector:
    app: cleo
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: cleo-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: neu.com
    http:
      paths:
      - path: /
        pathType: Exact
        backend:
          service:
            name: cleo-service
            port: 
              number: 80

The service and ingress are running:

enter image description here

Can somebody see what the problem is?


Solution

  • The direct access only works on Linux, the docker network is not accessible on macOS or on Windows

    https://docs.docker.com/desktop/mac/networking/#known-limitations-use-cases-and-workarounds

    Reference: https://github.com/kubernetes/minikube/issues/13951