<p>On a GKE cluster, I have client and server pods, with a client service and a server service.</p>
<p>My server service is:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: server-cluster-ip-service
spec:
  type: ClusterIP
  selector:
    app: server-deployment
  ports:
    - port: 5000
      targetPort: 5000
</code></pre>
<p>When I access the client pod shell and run</p>
<pre><code>nslookup server-cluster-ip-service
</code></pre>
<p>I get</p>
<pre><code>Server:         server-IP
Address:        server-IP-Address

Name:   server-cluster-ip-service.default.svc.cluster.local
Address: IPAddress

** server can't find server-cluster-ip-service.svc.cluster.local: NXDOMAIN

** server can't find server-cluster-ip-service.cluster.local: NXDOMAIN


** server can't find server-cluster-ip-service.svc.cluster.local: NXDOMAIN
** server can't find server-cluster-ip-service.cluster.local: NXDOMAIN

** server can't find server-cluster-ip-service.us-central1-c.c.my-cluster.internal: NXDOMAIN

** server can't find server-cluster-ip-service.google.internal: NXDOMAIN

** server can't find server-cluster-ip-service.us-central1-c.c.my-cluster: NXDOMAIN

** server can't find server-cluster-ip-service.google.internal: NXDOMAIN

** server can't find server-cluster-ip-service.c.my-cluster.internal: NXDOMAIN
** server can't find server-cluster-ip-service.c.my-cluster.internal: NXDOMAIN
</code></pre>
<p>The service is running on port 5000, because when I set up a pod with busybox, I can curl from that pod like so:</p>
<pre><code>curl server-cluster-ip-service:5000
</code></pre>
<p>And it returns json from my server.</p>
<p>After experimenting with what address to put in the fetch request in my client code, the only way I can get a 200 response is with this:</p>
<pre><code>const getAllUsers = async () =&gt; {
    console.log(&quot;GETTING ALL USERS&quot;);
    const response = await fetch(&quot;server-cluster-ip-service.default.svc.cluster.local&quot;, {
  mode: 'cors',
  headers: {
    'Access-Control-Allow-Origin':'*'
  }
});
    const resp = await response
    console.log(&quot;RESPONSE&quot;, resp)
    const json = await response.json();

    setUsers(json);
  };
</code></pre>
<p><a href="https://i.stack.imgur.com/juP9L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/juP9L.png" alt="enter image description here" /></a></p>
<p>which returns not json and not apparently on port 5000,</p>
<p>whereas all attempts to query the service at port 5000 fail.</p>
<p>I have this running locally and it works fine. I have ruled out arm processor issues with my mac by building and pushing docker images in GKE from the cloud console. I am fairly confident this is a GKE issue, because the dns works locally, but why would it not work with GKE? I don't have any network policies I've set myself - could there be a node security group blocking access? I read about &quot;shielding&quot; as a node security policy configured at setup, but I don't know how to check if that's been configured?</p>
<p>Complete code below:</p>
<p>My server code is:</p>
<pre><code>const express = require(&quot;express&quot;);
const bodyParser = require(&quot;body-parser&quot;);

var cors = require(&quot;cors&quot;);

const PORT = 5000;

const app = express();
app.use(cors());

app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(express.static(&quot;public&quot;));

app.listen(PORT, function () {
  console.log(&quot;listening on 5000&quot;);
});

app.get(&quot;/&quot;, (req, res) =&gt; {
  console.log(&quot;PROCESSING GET USERS REQUEST&quot;);
  const list = [&quot;item1&quot;, &quot;item2&quot;, &quot;item3&quot;];
  res.json(list);
});
</code></pre>
<p>My client code is:</p>
<pre><code>import { useState, useEffect } from &quot;react&quot;;

import &quot;./editUser.css&quot;;

    function EditUser() {
      const [users, setUsers] = useState([]);
    
      const getAllUsers = async () =&gt; {
        console.log(&quot;GETTING ALL USERS&quot;);
        const response = await fetch(&quot;http://server-cluster-ip-service:5000&quot;);
        const json = await response.json();
    
        setUsers(json);
      };
    
      useEffect(() =&gt; {
        getAllUsers();
      }, []);
    
      return (
        &lt;div className=&quot;App&quot;&gt;
          &lt;h1 data-position=&quot;header&quot;&gt;Merr k8s testbed&lt;/h1&gt;
    
          &lt;section data-position=&quot;quotes&quot;&gt;
            &lt;h2&gt;Console&lt;/h2&gt;
            &lt;ul&gt;
              {users &amp;&amp;
                users.map((user) =&gt; (
                  &lt;li&gt;
                    &lt;h3&gt;{user}&lt;/h3&gt;
                  &lt;/li&gt;
                ))}
            &lt;/ul&gt;
          &lt;/section&gt;
        &lt;/div&gt;
      );
    }
    
    export default EditUser;
</code></pre>
<p>My client-deployment.yaml is:</p>
<pre><code>kind: Deployment
metadata:
  name: client-deployment
  labels:
    app: client-deployment
    component: web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: client-deployment
  template:
    metadata: 
      labels:
        app: client-deployment
        component: web
    spec:
      containers:
        - name: client
          image: myDocker/k8s-client:latest
          ports:
            - containerPort: 3000
</code></pre>
<p>My server-deployment.yaml is:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-deployment
  labels:
    app: server-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: server-deployment
  template:
    metadata:
      labels:
        app: server-deployment
    spec:
      containers:
        - name: server
          image: myDocker/k8s-server:latest
          ports:
            - containerPort: 5000
</code></pre>
<p>My client-cluster-ip-service.yaml is:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-deployment
  labels:
    app: server-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: server-deployment
  template:
    metadata:
      labels:
        app: server-deployment
    spec:
      containers:
        - name: server
          image: myDocker/k8s-server:latest
          ports:
            - containerPort: 5000
</code></pre>
<p>My server-cluster-ip-service.yaml is:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: server-cluster-ip-service
spec:
  type: ClusterIP
  selector:
    app: server-deployment
  ports:
    - port: 5000
      targetPort: 5000
</code></pre>

Davtho1983
<p>I was able to see that you and jabbson concluded that probably the issue is with React. Just in case let me share with you that, a common root cause for this kind of issue is that the DNS inside Busybox does not work properly, due to the version (I cannot see in the screenshots and the code, the version that you are using). Most of the cases work with busybox images 1.28.4, empirically talking. You can try using that version.</p>
<p>You can use the following URL’s thread as reference <a href="https://github.com/kubernetes/kubernetes/issues/66924" rel="nofollow noreferrer">dns can't resolve kubernetes.default and/or cluster.local</a></p>
