WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Kubernetes cni doesn't work

Open nakazawa-summit opened this issue 7 years ago • 1 comments

I installed Ubuntu on WSL2 in the environment shown below. I registered this Ubuntu as a worker node for Kubernetes cluster with the procedures shown below. Registration was successful completed, but canal pod is in CrashLoopBackOff status. How is it possible to run canal pod?

[my environment]

  • Windows 10 Pro Insider Preview 1903 build 18922.1000

    • WSL
  • WSL2 Ubuntu

    • Docker 18.09.5-ce
    • kubectl 1.14.3
    • kubeadm 1.14.3
    • kubelet 1.14.3
  • Master Node

    • Ubuntu Server 18.04.2
    • Docker 18.09.5-ce
    • kubectl 1.14.3
    • kubeadm 1.14.3
    • kubelet 1.14.3

[my procedures]

  1. run Ubuntu on WSL2

  2. start Docker Service

     $ sudo service docker start
    
  3. create a token to join the cluster on MasterNode

     $ kubeadm token generate
     $ kubeadm token create [key] --print-join-command
    
  4. execute the following command on Ubuntu

     $ sudo kubeadm join [masterIP]:6443 --token [token] --discovery-token-ca-cert-hash [hash]
    

[the result]

    summit@master:~$ kubectl get pod -n kube-system -o wide
    NAME                             READY   STATUS             RESTARTS   AGE     IP               NODE              NOMINATED NODE   READINESS GATES
    canal-wjs4r                      3/3     Running            0          19d     192.168.41.87    master            <none>           <none>
    canal-x2fvg                      1/3     CrashLoopBackOff   124        4h30m   192.168.49.105   desktop-ljv6v6u   <none>           <none>
    coredns-fb8b8dccf-ccwft          1/1     Running            0          20d     10.244.0.2       master            <none>           <none>
    coredns-fb8b8dccf-gvh84          1/1     Running            0          20d     10.244.0.3       master            <none>           <none>
    etcd-master                      1/1     Running            0          20d     192.168.41.87    master            <none>           <none>
    kube-apiserver-master            1/1     Running            0          20d     192.168.41.87    master            <none>           <none>
    kube-controller-manager-master   1/1     Running            0          20d     192.168.41.87    master            <none>           <none>
    kube-proxy-97kjm                 1/1     Running            0          18d     192.168.41.87    master            <none>           <none>
    kube-proxy-cxjg9                 1/1     Running            0          4h30m   192.168.49.105   desktop-ljv6v6u   <none>           <none>
    kube-scheduler-master            1/1     Running            0          20d     192.168.41.87    master            <none>           <none>

    summit@master:~$ kubectl describe pod -n kube-system canal-x2fvg
    Name:               canal-x2fvg
    Namespace:          kube-system
    Priority:           0
    PriorityClassName:  <none>
    Node:               desktop-ljv6v6u/192.168.49.105
    Start Time:         Mon, 08 Jul 2019 12:36:01 +0900
    Labels:             controller-revision-hash=68cffd785b
                        k8s-app=canal
                        pod-template-generation=1
    Annotations:        scheduler.alpha.kubernetes.io/critical-pod:
    Status:             Running
    IP:                 192.168.49.105
    Controlled By:      DaemonSet/canal
    Containers:
      calico-node:
        Container ID: docker://b8b7441df2c3798cdb815ffc0aeb914628339236524ab4f1fd9955f2df67d3e9
        Image:          calico/node:v3.3.6
        Image ID:       docker-pullable://calico/node@sha256:8de3fb410d8b2b1effe57c433ab1d4ce18ccc23f2bb9c418837bfcdbac4494a0
        Port:           <none>
        Host Port:      <none>
        State:          Running
          Started:      Mon, 08 Jul 2019 17:12:47 +0900
        Last State:     Terminated
          Reason:       Error
          Exit Code:    137
          Started:      Mon, 08 Jul 2019 17:06:33 +0900
          Finished:     Mon, 08 Jul 2019 17:07:42 +0900
        Ready:          False
        Restart Count:  79
        Requests:
          cpu:      250m
        Liveness:   http-get http://localhost:9099/liveness delay=10s timeout=1s period=10s #success=1 #failure=6
        Readiness:  http-get http://localhost:9099/readiness delay=0s timeout=1s period=10s #success=1 #failure=3
        Environment:
          DATASTORE_TYPE:                     kubernetes
          WAIT_FOR_DATASTORE:                 true
          NODENAME:                            (v1:spec.nodeName) 
          CALICO_NETWORKING_BACKEND:          none
          CLUSTER_TYPE:                       k8s,canal
          FELIX_IPTABLESREFRESHINTERVAL:      60
          IP:
          CALICO_IPV4POOL_CIDR:               192.168.0.0/16
          CALICO_DISABLE_FILE_LOGGING:        true
          FELIX_DEFAULTENDPOINTTOHOSTACTION:  ACCEPT
          FELIX_IPV6SUPPORT:                  false
          FELIX_LOGSEVERITYSCREEN:            info
          FELIX_HEALTHENABLED:                true
        Mounts:
          /lib/modules from lib-modules (ro)
          /run/xtables.lock from xtables-lock (rw)
          /var/lib/calico from var-lib-calico (rw)
          /var/run/calico from var-run-calico (rw)
          /var/run/secrets/kubernetes.io/serviceaccount from canal-token-bpx2h (ro)
      install-cni:
        Container ID:  docker://1bc714d3b4919aa1277a1b95d9b95a6447a5330bd0998177f46af234570b6d1d
        Image:         calico/cni:v3.3.6
        Image ID:      docker-pullable://calico/cni@sha256:865b258549cd7a14d6a424de058536e8a6844264f43e94f8166eb16b95ac8905
        Port:          <none>
        Host Port:     <none>
        Command:
          /install-cni.sh
        State:          Running
          Started:      Mon, 08 Jul 2019 12:37:04 +0900
        Ready:          True
        Restart Count:  0
        Environment:
          CNI_CONF_NAME:         10-canal.conflist
          KUBERNETES_NODE_NAME:   (v1:spec.nodeName)
          CNI_NETWORK_CONFIG:    <set to the key 'cni_network_config' of config map 'canal-config'>  Optional: false
        Mounts:
          /host/etc/cni/net.d from cni-net-dir (rw)
          /host/opt/cni/bin from cni-bin-dir (rw)
          /var/run/secrets/kubernetes.io/serviceaccount from canal-token-bpx2h (ro)
      kube-flannel:
        Container ID: docker://ed401cbf98e1fba1c1cb954d92ee730fada96b6c23f5f8e4f20f5e10b447d6e1
        Image:         quay.io/coreos/flannel:v0.11.0
        Image ID:      docker-pullable://quay.io/coreos/flannel@sha256:3fa662e491a5e797c789afbd6d5694bdd186111beb7b5c9d66655448a7d3ae37
        Port:          <none>
        Host Port:     <none>
        Command:
          /opt/bin/flanneld
          --ip-masq
          --kube-subnet-mgr
        State:          Waiting
          Reason:       CrashLoopBackOff
        Last State:     Terminated
          Reason:       Error
          Exit Code:    1
          Started:      Mon, 08 Jul 2019 17:09:44 +0900
          Finished:     Mon, 08 Jul 2019 17:10:14 +0900
        Ready:          False
        Restart Count:  53
        Environment:
          POD_NAME:          canal-x2fvg (v1:metadata.name)
          POD_NAMESPACE:     kube-system (v1:metadata.namespace)
          FLANNELD_IFACE:    <set to the key 'canal_iface' of config map 'canal-config'>  Optional: false
          FLANNELD_IP_MASQ:  <set to the key 'masquerade' of config map 'canal-config'>   Optional: false
        Mounts:
          /etc/kube-flannel/ from flannel-cfg (rw)
          /run/xtables.lock from xtables-lock (rw)
          /var/run/secrets/kubernetes.io/serviceaccount from canal-token-bpx2h (ro)
    Conditions:
      Type              Status
      Initialized       True
      Ready             False
      ContainersReady   False
      PodScheduled      True
    Volumes:
      lib-modules:
        Type:          HostPath (bare host directory volume)
        Path:          /lib/modules
        HostPathType:
      var-run-calico:
        Type:          HostPath (bare host directory volume)
        Path:          /var/run/calico
        HostPathType:
      var-lib-calico:
        Type:          HostPath (bare host directory volume)
        Path:          /var/lib/calico
        HostPathType:
      xtables-lock:
        Type:          HostPath (bare host directory volume)
        Path:          /run/xtables.lock
        HostPathType:  FileOrCreate
      flannel-cfg:
        Type:      ConfigMap (a volume populated by a ConfigMap)
        Name:      canal-config
        Optional:  false
      cni-bin-dir:
        Type:          HostPath (bare host directory volume)
        Path:          /opt/cni/bin
        HostPathType:
      cni-net-dir:
        Type:          HostPath (bare host directory volume)
        Path:          /etc/cni/net.d
        HostPathType:
      canal-token-bpx2h:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  canal-token-bpx2h
        Optional:    false
    QoS Class:       Burstable
    Node-Selectors:  beta.kubernetes.io/os=linux
    Tolerations:     :NoSchedule
                     :NoExecute
                     CriticalAddonsOnly
                     node.kubernetes.io/disk-pressure:NoSchedule
                     node.kubernetes.io/memory-pressure:NoSchedule
                     node.kubernetes.io/network-unavailable:NoSchedule
                     node.kubernetes.io/not-ready:NoExecute
                     node.kubernetes.io/pid-pressure:NoSchedule
                     node.kubernetes.io/unreachable:NoExecute
                     node.kubernetes.io/unschedulable:NoSchedule
    Events:
      Type     Reason     Age                     From                      Message
      ----     ------     ----                    ----                      -------
      Warning  Unhealthy  18m (x533 over 4h47m)   kubelet, desktop-ljv6v6u  Readiness probe failed: Get http://localhost:9099/readiness: dial tcp 127.0.0.1:9099: connect: connection refused
      Warning  BackOff    13m (x1295 over 4h47m)  kubelet, desktop-ljv6v6u  Back-off restarting failed container

nakazawa-summit avatar Jul 08 '19 08:07 nakazawa-summit

I am using rancher manager to provision an RKE2 worker node in win11/WSL2. And end up in the same status. The cluster is ok as it already has 6 working nodes and working apps on it. I am using calico cni. and custom kernel with many networks features enabled.

alex-guo-github avatar Nov 29 '22 11:11 alex-guo-github