<p>I have a problem that my pods in minikube cluster are not able to see the service through the domain name.</p>

<p>to run my minikube i use the following commands (running on windows 10):<br>
<code>minikube start --vm-driver hyperv;</code><br>
<code>minikube addons enable kube-dns;</code><br>
<code>minikube addons enable ingress;</code>  </p>

<p>This is my <code>deployment.yaml</code></p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    run: hello-world
  name: hello-world
  namespace: default
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      run: hello-world
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        run: hello-world
    spec:
      containers:
      - image: karthequian/helloworld:latest
        imagePullPolicy: Always
        name: hello-world
        ports:
        - containerPort: 80
          protocol: TCP
        resources: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
</code></pre>

<p>this is the <code>service.yaml</code>:</p>

<pre><code>apiVersion: v1                                                             
kind: Service                                                              
metadata:                                                                  
  labels:                                                                  
    run: hello-world                                                       
  name: hello-world                                                        
  namespace: default                                                       
  selfLink: /api/v1/namespaces/default/services/hello-world                
spec:                                                                      
  ports:                                                                   
  - nodePort: 31595                                                        
    port: 80                                                               
    protocol: TCP                                                          
    targetPort: 80                                                         
  selector:                                                                
    run: hello-world                                                       
  sessionAffinity: None                                                    
  type: ExternalName
  externalName: minikube.local.com                                                           
status:                                                                    
  loadBalancer: {}                                                        
</code></pre>

<p>this is my <code>ingress.yaml</code>:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: minikube-local-ingress
spec:
  rules:
  - host: minikube.local.com
    http:
      paths:
      - path: /
        backend:
          serviceName: hello-world
          servicePort: 80
</code></pre>

<p>So, if i go inside the <code>hello-world</code> pod and from <code>/bin/bash</code> will run <code>curl minikube.local.com</code> or <code>nslookup minikube.local.com</code>.</p>

<p>So how can i make sure that the pods can resolve the DNS name of the service?
I know i can specify <code>hostAlias</code> in the deployment definition, but is there an automatic way tht will allow to update the DNS of kubernetes?</p>

GrimSmiler
<p>So, you want to expose your app on Minikube? I've just tried it using the default <code>ClusterIP</code> service type (essentially, removing the <code>ExternalName</code> stuff you had) and with <a href="https://gist.github.com/mhausenblas/37e43f1755f2895a2f87719bb4144daa" rel="nofollow noreferrer">this YAML file</a> I can see your service on <code>https://192.168.99.100</code> where the Ingress controller lives:</p>

<p><a href="https://i.stack.imgur.com/9FhbL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9FhbL.png" alt="screen shot of hello-world app in browser"></a></p>

<p>The service now looks like so:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    run: hello-world
  name: hello-world
spec:
  ports:
  - port: 80
    targetPort: 80
  selector:
    run: hello-world
</code></pre>

<p>And the ingress is:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: minikube-local-ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host:
    http:
      paths:
      - path: /
        backend:
          serviceName: hello-world
          servicePort: 80
</code></pre>

<p>Note: Within the cluster your service is now available via <code>hello-world.default</code> (that's the DNS name assigned by Kubernetes within the cluster) and from the outside you'd need to map, say <code>hello-world.local</code> to 192.168.99.100 in your <code>/etc/hosts</code> file on your host machine. </p>

<p>Alternatively, if you change the <code>Ingress</code> resource to <code>- host: hello-world.local</code> then you can (from the host) reach your service using this FQDN like so: <code>curl -H "Host: hello-world.local" 192.168.99.100</code>.</p>
