<p>I'm running a simple spring microservice project with Minikube. I have two projects: lucky-word-client (on port 8080) and lucky-word-server (on port 8888). But I can't communicate client with server. Infact if lucky-word-client communicates with lucky-word-server, the result is the word "Evviva", else the word is "Default". When I run on terminal: minikube service lucky-client the output is Default, instead of Evviva. I want communicate client with server through DNS. I saw the guide: <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/</a> but without success. How i can modify the service or pods to have the link between client and server?</p>

<p>This is the pod of lucky-word-client:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: lucky-client
  namespace: default
spec:
  containers:
  - image: lucky-client-img
    imagePullPolicy: IfNotPresent
    name: lucky-client
</code></pre>

<p>This is the pod of lucky-word-server:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: lucky-server
  namespace: default
spec:
  containers:
  - image: lucky-server-img
    imagePullPolicy: IfNotPresent
    name: lucky-server
</code></pre>

<p>This is the service, where the lucky-word-client communicate with lucky-word-server:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: lucky-client
spec:
  selector:
    app: lucky-client
  ports:
  - protocol: TCP
    targetPort: 8080
    port: 80
  type: NodePort
</code></pre>

Danny
<p>If you want to have DNS based service discovery to communicate with the server follow the below steps: </p>

<ol>
<li>Enable kube-dns addon via <code>minikube addons enable kube-dns</code> command. This will enable the service discovery in your kubernetes cluster.</li>
<li>Make sure that kube-dns addon is enable using <code>minikube addons list</code> command.</li>
<li>In your client application code change the server URL endpoint to the following : <code>http://lucky-server:8888</code>. "lucky-server" is the <strong>metadata.name</strong> property of your Kubernetes server service yaml definition.</li>
<li>Or else instead of <code>lucky-server</code> you can use fully qualified name <code>lucky-server.default.svc.cluster.local</code> in the server URL since you are deploying your service in default namespace. </li>
</ol>
