Using kubespray to install kubernetes always fails, which looks like a bug

Viewed 1141

I use kubespray(v2.11.0) install kubernetes(1.14.0).I have three vm.(plan two master,one nodes) Due to network reasons, I used the internal image repo and storage server. then i exec “ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml” command. the first time,it failed on node2. because of the task: [kubernetes-apps/network_plugin/flannel : Flannel | Wait for flannel subnet.env file presence]. the error is timeout to wait. but I exec "kubectl get nodes" I get this:

root@node1:~/kubespray# kubectl get nodes
NAME    STATUS   ROLES    AGE   VERSION
node1   Ready    master   22h   v1.14.0
node3   Ready    <none>   69m   v1.14.0

So i think may be i should copy the first master 's file to the second master node.

scp node1:/run/flannel/subnet.env node2:/run/flannel

then i exec the command "ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml" again. this time all the task are ok. no fail. but I still can't get the node2 in kubernetes. which you can see that below.

TASK [kubernetes/preinstall : run growpart] *******************************************************************************************************************************
Sunday 11 October 2020  22:20:34 -0400 (0:00:00.085)       0:05:19.550 ******** 

TASK [kubernetes/preinstall : run xfs_growfs] *****************************************************************************************************************************
Sunday 11 October 2020  22:20:34 -0400 (0:00:00.084)       0:05:19.635 ******** 

PLAY RECAP ****************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0   
node1                      : ok=533  changed=24   unreachable=0    failed=0   
node2                      : ok=608  changed=33   unreachable=0    failed=0   
node3                      : ok=454  changed=20   unreachable=0    failed=0   

Sunday 11 October 2020  22:20:34 -0400 (0:00:00.069)       0:05:19.704 ******** 
=============================================================================== 
kubernetes/client : Generate admin kubeconfig with external api endpoint ------------------------------------------------------------------------------------------ 10.37s
download : download_container | Download image if required --------------------------------------------------------------------------------------------------------- 7.51s
kubernetes-apps/network_plugin/flannel : Flannel | Wait for flannel subnet.env file presence ----------------------------------------------------------------------- 5.19s
etcd : wait for etcd up -------------------------------------------------------------------------------------------------------------------------------------------- 4.46s
container-engine/docker : ensure docker packages are installed ----------------------------------------------------------------------------------------------------- 4.13s
kubernetes-apps/ansible : Kubernetes Apps | Start Resources -------------------------------------------------------------------------------------------------------- 3.47s
kubernetes-apps/ingress_controller/ingress_nginx : NGINX Ingress Controller | Apply manifests ---------------------------------------------------------------------- 2.48s
kubernetes-apps/ansible : Kubernetes Apps | Lay Down CoreDNS Template ---------------------------------------------------------------------------------------------- 2.39s
kubernetes/master : kubeadm | write out kubeadm certs -------------------------------------------------------------------------------------------------------------- 2.29s
etcd : reload etcd ------------------------------------------------------------------------------------------------------------------------------------------------- 2.04s
kubernetes-apps/ingress_controller/ingress_nginx : NGINX Ingress Controller | Create manifests --------------------------------------------------------------------- 2.00s
download : download | Download files / images ---------------------------------------------------------------------------------------------------------------------- 1.71s
bootstrap-os : Fetch /etc/os-release ------------------------------------------------------------------------------------------------------------------------------- 1.52s
kubernetes/master : slurp kubeadm certs ---------------------------------------------------------------------------------------------------------------------------- 1.44s
bootstrap-os : Install dbus for the hostname module ---------------------------------------------------------------------------------------------------------------- 1.11s
kubernetes/master : Backup old certs and keys ---------------------------------------------------------------------------------------------------------------------- 1.08s
download : download | Download files / images ---------------------------------------------------------------------------------------------------------------------- 1.04s
download : download_file | Download item --------------------------------------------------------------------------------------------------------------------------- 0.98s
download : download | Sync files / images from ansible host to nodes ----------------------------------------------------------------------------------------------- 0.95s
container-engine/docker : Ensure old versions of Docker are not installed. | Debian -------------------------------------------------------------------------------- 0.93s
root@node1:~/kubespray# kc get nodes
The program 'kc' is currently not installed. You can install it by typing:
apt install kimwitu
root@node1:~/kubespray# kubectl get nodes
NAME    STATUS   ROLES    AGE   VERSION
node1   Ready    master   22h   v1.14.0
node3   Ready    <none>   69m   v1.14.0
root@node1:~/kubespray#

someone tell me how to fix and debug this problem.

0 Answers
Related