<p>I am new to Kubernetes and I'm experimenting with different things. This is my deployment file:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hellok8s
spec:
  replicas: 2
  selector:
    matchLabels:
      app: hellok8s
  template:
    metadata:
      labels:
        app: hellok8s
    spec:
      containers:
      - image: brianstorti/hellok8s:v3
        name: hellok8s-container
</code></pre>
<p>and below is my service file.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: hellok8s-svc
spec:
  type: NodePort
  selector:
    app: hellok8s
  ports:
  - port: 4567
    nodePort: 30001
</code></pre>
<p>I'm using the exec command and from inside the container, I'm trying to access the service using the service name. When I access this using the cluster IP, it works fine but when I try to access it using the service name it doesn't work. what might be the problem?</p>

nimramubashir
<p>Posted as community wiki, to better visibility.
As <a href="https://stackoverflow.com/users/14802233/nimramubashir">nimramubashir</a> mentioned in the comment:</p>
<blockquote>
<p>I have debugged deeper and there seems to be some problem with the internal pod-pod communication. I'm creating a cluster through kubeadm and there seems to be some problem with it that Is causing this problem. I'm asking a new question for that. I have tried deploying it on the cloud and this is working fine.</p>
</blockquote>
