title: Kubernetes nginx Ingress configuration not working for Grafana
body: <p>I am new to configuring Ingress rules for my Kubernetes cluster.</p>
  
  <p>My Kubernetes cluster is deployed on Bare Metal. No cloud.</p>
  
  <p>I followed this <a href="https://kubernetes.github.io/ingress-nginx/deploy/#generic-deployment" rel="nofollow noreferrer">link</a> to set up my nginx-controller with RBAC in my cluster.</p>
  
  <p>This is what I have deployed :</p>
  
  <pre><code># kubectl get all -n ingress-nginx
  NAME                                           READY     STATUS    RESTARTS   AGE
  pod/default-http-backend-7c5bc89cc9-ks6kd      1/1       Running   0          2h
  pod/nginx-ingress-controller-5b6864749-8xbhf   1/1       Running   0          2h
  
  NAME                           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                      AGE
  service/default-http-backend   ClusterIP   10.233.15.56   &lt;none&gt;        80/TCP                       2h
  service/ingress-nginx          NodePort    10.233.38.84   &lt;none&gt;        80:31118/TCP,443:32003/TCP   2h
  
  NAME                                       DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
  deployment.apps/default-http-backend       1         1         1            1           2h
  deployment.apps/nginx-ingress-controller   1         1         1            1           2h
  
  NAME                                                 DESIRED   CURRENT   READY     AGE
  replicaset.apps/default-http-backend-7c5bc89cc9      1         1         1         2h
  replicaset.apps/nginx-ingress-controller-5b6864749   1         1         1         2h
  </code></pre>
  
  <p>Given that I have my setup, I want to access my grafana dashboard using a URL.</p>
  
  <p>My grafana setup is working perfectly fine.</p>
  
  <pre><code># kubectl get all -n default
  NAME                           READY     STATUS    RESTARTS   AGE
  pod/grafana-67c6585fbd-4jl7p   1/1       Running   0          2h
  
  NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
  service/grafana      NodePort    10.233.5.111   &lt;none&gt;        3000:32093/TCP   2h
  
  
  NAME                      DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
  deployment.apps/grafana   1         1         1            1           2h
  
  NAME                                 DESIRED   CURRENT   READY     AGE
  replicaset.apps/grafana-67c6585fbd   1         1         1         2h
  </code></pre>
  
  <p>I can access the dashboard using <code>http://10.27.239.145:32093</code> which is the IP of one of my K8S worker nodes.</p>
  
  <p>Now rather than accessing via IP:NodePort, I want to access via URL e.g. <code>grafana.test.mydomain.com</code></p>
  
  <p>So the ingress rule that I configured in my default namespace is :</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    annotations:
      kubernetes.io/ingress.class: nginx
    creationTimestamp: 2018-09-25T20:32:24Z
    generation: 5
    name: grafana
    namespace: default
    resourceVersion: "28485"
    selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/jenkins-tls
    uid: 1c51cece-c102-11e8-bf0f-02000a1bef39
  spec:
    rules:
    - host: grafana.test.mydomain.com
      http:
        paths:
        - backend:
            serviceName: grafana
            servicePort: 3000
          path: /
  </code></pre>
  
  <p>On my local laptop from where I am testing, Ive added to my <code>/etc/hosts</code> the following entry :</p>
  
  <pre><code>10.27.239.145 grafana.test.mydomain.com
  </code></pre>
  
  <p>And in my browser, I am trying to access <code>http://grafana.test.mydomain.com</code> but I only get <code>This site can’t be reached
  grafana.test.mydomain.com refused to connect.</code></p>
  
  <p>I have a strong feeling that I am missing out on something but can't figure it out.</p>
  
  <p>I changed the NodePort to ClusterIP but no luck.</p>
  
  <p>I know that my ingress controller is working since everytime I make a change to my ingress rules, I get logs from my ingress controller.</p>
  
  <pre><code>I0925 21:00:19.041440       9 event.go:221] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"grafana", UID:"1c51cece-c102-11e8-bf0f-02000a1bef39", APIVersion:"extensions/v1beta1", ResourceVersion:"28485", FieldPath:""}): type: 'Normal' reason: 'UPDATE' Ingress default/grafana
  I0925 21:00:19.041732       9 controller.go:171] Configuration changes detected, backend reload required.
  I0925 21:00:19.216044       9 controller.go:187] Backend successfully reloaded.
  I0925 21:00:19.217645       9 controller.go:204] Dynamic reconfiguration succeeded.
  </code></pre>
  
  <p>Any help will strongly be appreciated regarding what might I have missed.</p>