<p>I have a ruby on rails deployment and I want to use it in the frontend deployment so I created a service exposing port 3000 called &quot;flicron-backend-service&quot;</p>
<p>here is the description of the service</p>
<pre><code>kubectl describe svc flicron-backend-service                      
Name:              flicron-backend-service
Namespace:         default
Labels:            io.kompose.service=flicron-backend-service
Annotations:       kompose.cmd: kompose convert -f docker-compose.yml
                   kompose.version: 1.28.0 (c4137012e)
Selector:          io.kompose.service=flicron-backend
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.107.112.244
IPs:               10.107.112.244
Port:              3000  3000/TCP
TargetPort:        3000/TCP
Endpoints:         10.244.0.144:3000
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>
<p>I am trying to use the service name but it does not get resolved
I have tried from inside minikube to curl the backend-service-name did not work</p>
<pre><code>curl flicron-backend-service:3000
curl: (6) Could not resolve host: flicron-backend-service

curl flicron-backend-service.default.svc.cluster.local:3000
curl: (6) Could not resolve host: flicron-backend-service.default.svc.cluster.local

</code></pre>
<p>but if I used the ip it works fine</p>
<pre><code>curl 10.107.112.244:3000
# some HTML
</code></pre>
<p>Here is my DNS configuration</p>
<pre><code>kubectl describe cm coredns -n kube-system
Name:         coredns
Namespace:    kube-system
Labels:       &lt;none&gt;
Annotations:  &lt;none&gt;

Data
====
Corefile:
----
.:53 {
    log
    errors
    health {
       lameduck 5s
    }
    ready
    kubernetes cluster.local in-addr.arpa ip6.arpa {
       pods insecure
       fallthrough in-addr.arpa ip6.arpa
       ttl 30
    }
    prometheus :9153
    hosts {
       192.168.49.1 host.minikube.internal
       fallthrough
    }
    forward . /etc/resolv.conf {
       max_concurrent 1000
    }
    cache 30
    loop
    reload
    loadbalance
}


BinaryData
====

Events:  &lt;none&gt;

</code></pre>
<p>FrontEnd Service</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    io.kompose.service: flicron-frontend-service
  name: flicron-frontend-service
spec:
  selector:
    app: flicron-frontend
  type: NodePort
  ports:
    - name: http
      port: 4000
      targetPort: 4000
      nodePort: 32123
</code></pre>
<p>backend service</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert -f docker-compose.yml
    kompose.version: 1.28.0 (c4137012e)
  creationTimestamp: null
  labels:
    io.kompose.service: flicron-backend-service
  name: flicron-backend-service
spec:
  # clusterIP: None
  ports:
    - name: &quot;3000&quot;
      port: 3000
      targetPort: 3000
  selector:
    io.kompose.service: flicron-backend # this maps this service to that deployment

</code></pre>

Sergi
<blockquote>
<p>I have tried from inside minikube to curl the backend-service-name did not work</p>
</blockquote>
<p>If you explicitly meant that you've:</p>
<ul>
<li>connected to your minikube instance (i.e. <code>minikube ssh</code>)</li>
<li><code>curl</code> the service name directly from <code>minikube</code> instance.</li>
</ul>
<p>Then it should <strong>not work</strong>.</p>
<p>It will work from a Pod/container that is targeting internal Kubernetes DNS resolution.</p>
<hr />
<p>Let me explain:</p>
<p>DNS resolution within Kubernetes environment is handled by <code>coredns</code> residing in <code>kube-system</code> namespace. It is a containerized service that is hosted inside of Kubernetes. Information on how to connect to it is injected to Pods via Kubelet.</p>
<p>You can see it by:</p>
<ul>
<li><code>kubectl run -it basic-pod --image=nginx -- /bin/bash</code></li>
<li><code>cat /etc/resolv.conf</code></li>
</ul>
<pre class="lang-bash prettyprint-override"><code>nameserver 10.96.0.10 # &lt;-- SERVICE KUBE-DNS IN KUBE-SYSTEM (CLUSTER-IP)
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
</code></pre>
<p>Minikube itself does not have the core-dns configured in <code>/etc/hosts</code>.</p>
<p>Try to contact your <code>Service</code> with an actual <code>Pod</code>:</p>
<ul>
<li><code>kubectl run -it basic-pod --image=nginx -- /bin/bash</code></li>
<li><code>apt update &amp;&amp; apt install dnsutils -y</code> - <code>nginx</code> image used for simplicity</li>
<li><code>nslookup nginx</code> - there is a <code>Service</code> named <code>nginx</code> in my <code>minikube</code></li>
</ul>
<pre class="lang-yaml prettyprint-override"><code>root@basic-pod:/# nslookup nginx
Server:     10.96.0.10
Address:    10.96.0.10#53

Name:   nginx.default.svc.cluster.local
Address: 10.109.51.22
</code></pre>
<p>I encourage you to take a look on following documentation:</p>
<ul>
<li><em><a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">Kubernetes.io: Docs: Concepts: Services networking: DNS Pod Service</a></em></li>
</ul>
