1

I've got a cluster running with 1 master + 2 workers and using flannel as CNI.

kubeadm init was called with apiserver address and 10.244.0.0 for flannel's and nodes are joined.

kubeadm init --apiserver-advertise-address=192.168.56.3 --pod-network-cidr=10.244.0.0/16

NAME READY STATUS RESTARTS
coredns-f9fd979d6-d6jkd 1/1 Running 0
coredns-f9fd979d6-fpzct 1/1 Running 0
etcd-kubemaster 1/1 Running 0
kube-apiserver-kubemaster 1/1 Running 0
kube-controller-manager-kubemaster 1/1 Running 0
kube-flannel-ds-5gd2w 1/1 Running 0
kube-flannel-ds-b4qzz 1/1 Running 0
kube-flannel-ds-m56bd 1/1 Running 0
kube-proxy-5hw6x 1/1 Running 0
kube-proxy-9wnpd 1/1 Running 0
kube-proxy-ffrmh 1/1 Running 0
kube-scheduler-kubemaster 1/1 Running 0

iptables was cleared, everything allowed and net.bridge.bridge-nf-call-iptables=1

But the cluster cant be reached.

http://192.168.56.3:32001/

times out.

kubectl config view

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://192.168.56.3:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED

What to do to get access to the cluster's services?

1

It turns out that flannel itself must be initialized with the k8s interface.

kubectl get pod --all-namespaces | grep flannel

kube-system   kube-flannel-ds-2676q                 1/1     Running   0

kubectl logs kube-flannel-ds-5gd2w -n kube-system -f

I0603 05:56:36.014958       1 main.go:520] Determining IP address of default interface
I0603 05:56:36.015399       1 main.go:533] Using interface with name enp0s3 and address 10.0.2.15

enp0s3 is incorrect interface.

delete daemonset:

kubectl delete ds kube-flannel-ds -n kube-system

delete flannel.1 link:

ip link delete flannel.1

download kube-flannel

curl https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml -O

Add --iface arg to the kube-flannel with the interface that k8s is advertised on

  • --iface=enp0s8

Apply it and k8s becomes accessible:

kubectl apply -f kube-flannel.yml

kubectl logs kube-flannel-ds-2676q -n kube-system -f
I0603 07:03:14.430280       1 main.go:533] Using interface with name enp0s8 and address 192.168.56.4

deleting the links is not necessary itself, flannel recreates it automatically

"flannel.1" already exists with incompatable configuration: vtep (external) interface: 3 vs 2; recreating device

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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