<p>I am learning kubernetes by playing with minikube.</p>

<p>This is my pod deployment file which is fine.</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      component: web
  template:
    metadata:
      labels:
        component: web
    spec:
      containers:
        - name: myapp
          image: myid/myimage
</code></pre>

<p>I am exposing the above pods using NodePort. I am able to access using minikube IP at port 30002.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-ip-service
spec:
  type: NodePort
  externalIPs:
  - 192.168.99.100
  selector:
    component: web
  ports:
    - port: 3000
      nodePort: 30002
      targetPort: 8080
</code></pre>

<p>Now i would like to use ingress to access the application at port 80 which will forward the request the ip-service at port 3000. It does NOT work</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
spec:
  backend:
    serviceName: my-ip-service
    servicePort: 3000
</code></pre>

<p>If i try to access to ingress, address is blank. </p>

<pre><code>NAME           HOSTS   ADDRESS   PORTS   AGE
test-ingress   *                 80      41m
</code></pre>

<p>How to use ingress with minikube? Or how to bind the minikube ip with ingress service - so that the app can be exposed outside without using nodeport</p>

<p>You can get your minikube node's IP address with:</p>

<pre><code>minikube ip
</code></pre>

<p>The ingress' IP address will not populate in minikube because minikube lacks a load balancer. If you'd like something that behaves like a load balancer for your minikube cluster, <a href="https://github.com/knative/serving/blob/master/docs/creating-a-kubernetes-cluster.md#loadbalancer-support-in-minikube" rel="nofollow noreferrer">https://github.com/knative/serving/blob/master/docs/creating-a-kubernetes-cluster.md#loadbalancer-support-in-minikube</a> suggests running the following commands to patch your cluster:</p>

<pre><code>sudo ip route add $(cat ~/.minikube/profiles/minikube/config.json | jq -r ".KubernetesConfig.ServiceCIDR") via $(minikube ip)
kubectl run minikube-lb-patch --replicas=1 --image=elsonrodriguez/minikube-lb-patch:0.1 --namespace=kube-system
</code></pre>
