<p>i am using node js trying to run grpc in kubernetes cluster env. localy without kubernetes its working fine.the server side is listening to : <code>'0.0.0.0:80'</code> and client tries to connect via: <a href="http://recommended-upgrades-qa-int" rel="nofollow noreferrer">http://recommended-upgrades-qa-int</a>. in the kuberenets i get the following error: </p>

<pre><code>ERROR failed to get via grpc the getRecommended Error: 14 UNAVAILABLE: Connect Failed endpoint:http://&lt;K8S_SERVICE_NAME&gt;
ERROR: Recommendations fetch error: Error: 14 UNAVAILABLE: Connect Failed severity=error, message=failed to get via grpc the getRecommended Error: 14 UNAVAILABLE: Connect Failed endpoint:http://&lt;K8S_SERVICE_NAME&gt;
</code></pre>

<p>server side:</p>

<pre><code>const connectionHost = this.listenHost + ':' + this.listenPort;
server.bind(connectionHost, grpc.ServerCredentials.createInsecure());
logger.info(`Server running at ${connectionHost}`);
server.start();
</code></pre>

<p>client side:</p>

<pre><code>RecommendedService = grpc.load(__dirname + '/../../node_modules/@zerto/lib-service-clients/Output/sources/recommendedClient.proto').RecommendedService;
        } catch (error){
            console.log(error);
        }

        this.client = RecommendedService &amp;&amp; new RecommendedService(grpcAddress, grpc.credentials.createInsecure());
</code></pre>

<p>manefist files:</p>

<h2>server side</h2>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-side-deployment
  namespace: default
spec:
  selector:
    matchLabels:
      app: server-side-deployment
  replicas: 1
  template:
    metadata:
      labels:
        app: server-side-deployment
    spec:
      containers:
      - name: server-side-deployment
        image: (DOCKER_IMAGE_PATH)
        imagePullPolicy: Always
        ports:
        - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: recommended-upgrades-qa-int
  namespace: default
spec:
  selector:
      app: server-side-deployment
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
      name: http
</code></pre>

<h2>client side</h2>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-side-deployment
  namespace: default
spec:
  selector:
    matchLabels:
      app: client-side-deployment
  replicas: 1
  template:
    metadata:
      labels:
        app: client-side-deployment
    spec:
      containers:
      - name: client-side-deployment
        image: (DOCKER_IMAGE_PATH)
        imagePullPolicy: Always
        env:
          - name: RECOMANDED_SERVICE
            value: http://recommended-upgrades-qa-int
        ports:
        - containerPort: 80
</code></pre>

Guy Barsade
<p>From the <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">docs</a>:</p>

<blockquote>
  <p>“Normal” (not headless) Services are assigned a DNS A record for a name of the form my-svc.my-namespace.svc.cluster.local. This resolves to the cluster IP of the Service.</p>
</blockquote>

<p>Your issue here is probably sing <code>&lt;service name&gt;</code> while your service is in another namespace. Try using:</p>

<pre><code>&lt;service name&gt;.&lt;service namespace&gt;.svc.cluster.local
</code></pre>
