kubernetes pods cannot communicate to outside world

10/3/2018

I have created an HA kubernetes cluster with kubeadm version 1.11.2 and installed calico CNI plugin which is up and running. I am trying to create a deployment with a docker image. It successfully created the deployment and created a container on the node but the container is failing to communicate to the outside world other than the node on which it's hosted (with the IP).

I have logged into the container and tried to ping the masters and other nodes it's failing.

Can anyone help me in resolving this issue?

-- Raghu.k
docker
kubernetes
kubernetes-ingress

1 Answer

10/3/2018

Hard to tell, but has to be an issue with Calico/CNI. Are all your Calico pods ready on all your nodes, like this:

$ kubectl get pods -n kube-system
NAME                                                                 READY     STATUS    RESTARTS   AGE
calico-node-xxxxx                                                    2/2       Running   0          15h

You can check the CNI configs under /etc/cni/net.d Maybe your install-cni.sh container in your Calico pod didn't initialize the configs? For example:

{
  "name": "k8s-pod-network",
  "cniVersion": "0.3.0",
  "plugins": [
    {
      "type": "calico",
      "log_level": "info",
      "datastore_type": "kubernetes",
      "nodename": "<node-name>",
      "mtu": 1500,
      "ipam": {
        "type": "host-local",
        "subnet": "usePodCidr"
      },
      "policy": {
        "type": "k8s"
      },
      "kubernetes": {
        "kubeconfig": "/etc/cni/net.d/calico-kubeconfig"
      }
    },
    {
      "type": "portmap",
      "snat": true,
      "capabilities": {"portMappings": true}
    }
  ]
}

Normally, your container will have an interface and podCidr IP assigned to it, so after you shell into the pod/containers you can check with $ ifconfig

-- Rico
Source: StackOverflow