Answers: <p>It turns out that flannel itself must be initialized with the k8s interface.</p>
  <pre><code>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
  </code></pre>
  <p>enp0s3 is incorrect interface.</p>
  <p>delete daemonset:</p>
  <pre><code>kubectl delete ds kube-flannel-ds -n kube-system
  </code></pre>
  <p>delete flannel.1 link:</p>
  <pre><code>ip link delete flannel.1
  </code></pre>
  <p>download kube-flannel</p>
  <p>curl <a href="https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml" rel="nofollow noreferrer">https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml</a> -O</p>
  <p>Add --iface arg to the kube-flannel with the interface that k8s is advertised on</p>
  <ul>
  <li>--iface=enp0s8</li>
  </ul>
  <p>Apply it and k8s becomes accessible:</p>
  <pre><code>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
  </code></pre>
  <p>deleting the links is not necessary itself, flannel recreates it automatically</p>
  <p>&quot;flannel.1&quot; already exists with incompatable configuration: vtep (external) interface: 3 vs 2; recreating device</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-06-03T07:21:48.313Z
Answers: 2021-06-03T07:21:48.313Z
Answers: Serve Laurijssen
Body: <p>I've got a cluster running with 1 master + 2 workers and using flannel as CNI.</p>
  <p>kubeadm init was called with apiserver address and 10.244.0.0 for flannel's and nodes are joined.</p>
  <pre><code>kubeadm init --apiserver-advertise-address=192.168.56.3 --pod-network-cidr=10.244.0.0/16
  </code></pre>
  <blockquote>
  <p>NAME                                 READY   STATUS    RESTARTS<br />
  coredns-f9fd979d6-d6jkd              1/1     Running   0<br />
  coredns-f9fd979d6-fpzct              1/1     Running   0<br />
  etcd-kubemaster                      1/1     Running   0<br />
  kube-apiserver-kubemaster            1/1     Running   0<br />
  kube-controller-manager-kubemaster   1/1     Running   0<br />
  kube-flannel-ds-5gd2w                1/1     Running   0<br />
  kube-flannel-ds-b4qzz                1/1     Running   0<br />
  kube-flannel-ds-m56bd                1/1     Running   0<br />
  kube-proxy-5hw6x                     1/1     Running   0<br />
  kube-proxy-9wnpd                     1/1     Running   0<br />
  kube-proxy-ffrmh                     1/1     Running   0<br />
  kube-scheduler-kubemaster            1/1     Running   0</p>
  </blockquote>
  <p>iptables was cleared, everything allowed and net.bridge.bridge-nf-call-iptables=1</p>
  <p>But the cluster cant be reached.</p>
  <blockquote>
  <p><a href="http://192.168.56.3:32001/" rel="nofollow noreferrer">http://192.168.56.3:32001/</a></p>
  </blockquote>
  <p>times out.</p>
  <pre><code>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
  </code></pre>
  <p>What to do to get access to the cluster's services?</p>
  
Tags: <kubernetes>
Title: unable to access cluster after installing flannel
UserDisplayName: Serve Laurijssen
ThreadText: # unable to access cluster after installing flannel
  
  (Asked by: username_0 on 2021-06-03)
  
  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?
  
  **Tags:** kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-06-03. Score: 1 | Accepted answer
  
  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
  
  
  ---
  
  