Search code examples
kubernetesflannel

k8s & flannel --- dial tcp 172.96.0.1:443: i/o timeout


  1. i init kubeadm with follow command

kubeadm init
--apiserver-advertise-address=192.168.64.104
--image-repository registry.cn-hangzhou.aliyuncs.com/google_containers
--kubernetes-version v1.17.3
--service-cidr=172.96.0.0/16
--pod-network-cidr=172.244.0.0/16

  1. i have one master and two node , i test follow command in three machine

curl -k https://172.96.0.1:443/version

command result:

 {
  "major": "1",
  "minor": "17",
  "gitVersion": "v1.17.3",
  "gitCommit": "06ad960bfd03b39c8310aaf92d1e7c12ce618213",
  "gitTreeState": "clean",
  "buildDate": "2020-02-11T18:07:13Z",
  "goVersion": "go1.13.6",
  "compiler": "gc",
  "platform": "linux/amd64"
}
  1. but when i use command helm install --namespace openebs --name openebs stable/openebs --version 1.5.0, i get result is Error: Get https://172.96.0.1:443/version?timeout=32s: dial tcp 172.96.0.1:443: i/o timeout

i don't know what is happened now, and how can i solve this problem?


Solution

  • I know that @wr1ttenyu zhao has already resolved this issue, but I decided to provide an answer just for clarification.

    As we can see in the flannel documentation:

    NOTE: If kubeadm is used, then pass --pod-network-cidr=10.244.0.0/16 to kubeadm init to ensure that the podCIDR is set.

    The --pod-network-cidr option specifies range of IP addresses for the pod network.

    We should use the 10.244.0.0/16 network because it's hardcoded in the kube-flannel.yml file:

      net-conf.json: |
        {
          "Network": "10.244.0.0/16",
          "Backend": {
            "Type": "vxlan"
          }
        }
    

    For this reason, creating a Kubernetes cluster with the kubeadm init --pod-network-cidr=10.244.0.0/16 command will work with flannel without any additional flannel configuration.

    To use a different network, we need to modify "Network": "10.244.0.0/16" line in the kube-flannel.yml file before applying it, similar to what is described in this answer.