<p>I am learning Kubernetes and i run into trouble reaching an API in my local Minikube (Docker driver).
I have a pod running an angluar-client which tries to reach a backend pod. The frontend Pod is exposed by a NodePort Service. The backend pod is exposed to the Cluster by a ClusterIP Service.</p>
<p>But when i try to reach the clusterip service from the frontend the dns <code>transpile-svc.default.svc.cluster.local</code> cannot get resolved.
<a href="https://i.stack.imgur.com/NEaQ6.png" rel="nofollow noreferrer">error message in the client</a></p>
<p>the dns should work properly. i followed this <a href="https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/</a>  and deployed a dnsutils pod from where i can <code>nslookup</code>.</p>
<pre><code>winpty kubectl exec -i -t dnsutils -- nslookup transpile-svc.default
Server:         10.96.0.10
Address:        10.96.0.10#53

Name:   transpile-svc.default.svc.cluster.local
Address: 10.99.196.82
</code></pre>
<p>This is the .yaml file for the clusterIP Service</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: transpile-svc
  labels: 
    app: transpile
spec:
  selector:
    app: transpile
  ports:
  - port: 80
    targetPort: 80
</code></pre>
<p>Even if i hardcode the IP into the request of the frontend i am getting an empty response.
I verified, that the backend pod is working correctly and when i expose it as a NodePort i can reach the api with my browser.</p>
<p>What am i missing here? Im stuck with this problems for quite some time now and i dont find any solution.</p>

Verwey
<p>Since your frontend application is calling your application from outside the cluster you need to expose your backend application to outside network too.</p>
<p>There are two ways: either expose it directly by changing transpile-svc service to loadbalancer type or introduce an ingress controller(eg Nginx ingress controller with an Ingres object) which will handle all redirections</p>
<p>Steps to expose service as loadbalancer in minikube</p>
<p>1.Change your service transpile-svc type to LoadBalancer
2.Run command minikube service transpile-svc to expose the service ie an IP will be allocated.
3. Run kubectl get services to get external IP assigned. Use IP:POST to call from frontend application</p>
