Search code examples
kuberneteskubernetes-helmnginx-ingressdocker-desktop

How to set nginx ingress with command helm create?


I can't make my ingress work in local docker-desktop

I made an helm create my-project-helm like everybody

then I do changes in ./my-project-helm/values.yaml I just show you the most interesting part (about ingress)

...

replicaCount: 3

image:
  repository: localhost:5000/my-project-helm
  tag: latest
  pullPolicy: IfNotPresent

...

service:
  type: ClusterIP
  port: 80

ingress:
  enabled: true
  annotations: {
    kubernetes.io/ingress.class: nginx
  }
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  hosts:
    - host: chart-example.local
      paths: [/]

...

I install this helm helm upgrade --install my-project-helm ./my-project-helm

I install nginx helm upgrade --install nginx-ingress stable/nginx-ingress

I am gonna check my ingress with kubectl describe ingress my-project-helm

Name:             my-project-helm
Namespace:        default
Address:          
Default backend:  default-http-backend:80 (<none>)
Rules:
  Host                 Path  Backends
  ----                 ----  --------
  chart-example.local  /     my-project-helm:80 (10.1.0.71:80,10.1.0.72:80,10.1.0.73:80)
Annotations:
  kubernetes.io/ingress.class:  nginx
Events:
  Type    Reason  Age   From                      Message
  ----    ------  ----  ----                      -------
  Normal  CREATE  14m   nginx-ingress-controller  Ingress default/my-project-helm
  Normal  UPDATE  13m   nginx-ingress-controller  Ingress default/my-project-helm

Everything seems so wonderful.

I make a curl chart-example.local nothing happens curl: (6) Could not resolve host: chart-example.local

Does anyone have a clue?


Solution

  • By default it should add the Kubernetes master domain in your /etc/hosts

    Check it with kubectl cluster-info

    So just use the default domain which is in my case kubernetes.docker.internal instead of chart-example.local.

    And yes it must point to the loadbalancer external IP of nginx which is localhost by default ;)