<p>I'm new to Kubernetes. I have setup 3 node cluster with two workers according to <a href="https://www.digitalocean.com/community/tutorials/how-to-create-a-kubernetes-cluster-using-kubeadm-on-ubuntu-18-04" rel="nofollow noreferrer">here</a>.<br/>
My configurations</p>

<pre><code>kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:53:57Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.10", GitCommit:"575467a0eaf3ca1f20eb86215b3bde40a5ae617a", GitTreeState:"clean", BuildDate:"2019-12-11T12:32:32Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<pre><code> kubeadm version
kubeadm version: &amp;version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:51:21Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>Deployed simple python service listen to 8000 port http and reply "Hello world"</p>

<p>my deployment config</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend-app
  labels:
    app: frontend-app
spec:
  replicas: 2 
  selector:
    matchLabels:
      app: frontend-app
  template:
    metadata:
      labels:
        app: frontend-app
    spec:
      containers:
      - name: pyfrontend
        image: rushantha/pyfront:1.0 
        ports:
        - containerPort: 8000
</code></pre>

<p>Exposed this as a service
<code>kubectl expose deploy frontend-app --port 8000</code></p>

<p>I can see it deployed and running.</p>

<pre><code>kubectl describe svc frontend-app
Name:              frontend-app
Namespace:         default
Labels:            app=frontend-app
Annotations:       &lt;none&gt;
Selector:          app=frontend-app
Type:              ClusterIP
IP:                10.96.113.192
Port:              &lt;unset&gt;  8000/TCP
TargetPort:        8000/TCP
Endpoints:         172.16.1.10:8000,172.16.2.9:8000
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>

<p>when I log in to each service machine and do curl pods respond
ie. <code>curl 172.16.1.10:8000 or curl 172.16.2.9:8000</code></p>

<p>However when I try to access the pods via the ClusterIp only one pod always responds. So curl sometimes hangs, most probably the other pod does not respond. I confirmed when I tail the access logs for both pods. One pod never received any requests. </p>

<pre><code>curl 10.96.113.192:8000/ ---&gt; Hangs sometimes.
</code></pre>

<p>Any ideas how to troubleshoot this and fix ?</p>

Sajith Silva
<p>After comparing the tutorial document and the outputs configuration
I discovered that the <code>--pod-network-cidr</code> declared in the document is different from the OP endpoints which solved the problem. </p>

<p>The network in the flannel configuration should match the <code>pod network CIDR</code> otherwise pods won`t be able to communicate with each other. </p>

<p>Some additional information that are worth checking: </p>

<ol>
<li><p>Under the <code>CIDR Notation</code> <a href="https://www.digitalocean.com/community/tutorials/understanding-ip-addresses-subnets-and-cidr-notation-for-networking" rel="nofollow noreferrer">section</a> there is a good explanation how this system works. </p></li>
<li><p>I find <a href="https://itnext.io/an-illustrated-guide-to-kubernetes-networking-part-1-d1ede3322727" rel="nofollow noreferrer">this document</a> about networking in kuberenetes very helpful. </p></li>
</ol>
