I'm trying to configure Kubernetes with web dashboard. I use these steps:

swapoff -a

Remove following line from /etc/fstab

/swap.img       none    swap    sw      0       0

then run these shell commands:

sudo apt update
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker 
sudo apt install apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" >> ~/kubernetes.list
sudo mv ~/kubernetes.list /etc/apt/sources.list.d
sudo apt update
sudo apt install kubeadm kubelet kubectl kubernetes-cni
sudo kubeadm init --pod-network-cidr=
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

I applied this configuration:

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
  name: flannel-fix
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: flannel
  - kind: ServiceAccount
    name: flannel
    namespace: kube-flannel
kubectl create -f <file>

But I get:

Error registering network: failed to acquire lease: subnet "" specified in the flannel net config doesn't contain "" PodCIDR of the "ubuntukubernetis1" node

Do you know what should be the correct configuration?


1 Answer 1


I figured it out by reading the documentation:

Take care that your Pod network must not overlap with any of the host networks: you are likely to see problems if there is any overlap.

Flannel uses and can't run on the same as your host... it creates new interfaces when implemented. So when you run this init command it should always be using

sudo kubeadm init --pod-network-cidr=

Once I did this, things started working as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.