[root@node01 k8s]# ./ezdown -S 2023-03-22 13:39:40 INFO Action begin: start_kubeasz_docker 2023-03-22 13:39:41 INFO try to run kubeasz in a container 2023-03-22 13:39:41 DEBUG get host IP: 10.10.11.49 2023-03-22 13:39:41 DEBUG generate ssh key pair # 10.10.11.49 SSH-2.0-OpenSSH_6.6.1 f1b442b7fdaf757c7787536b17d12d76208a2dd7884d56fbd1d35817dc2e94ca 2023-03-22 13:39:41 INFO Action successed: start_kubeasz_docker
[root@node01 k8s]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f1b442b7fdaf easzlab/kubeasz:3.5.0 "sleep 36000" 15 seconds ago Up 14 seconds kubeasz
执行后看不出是成功,还是失败。根据文档说明,进入容器内手动执行命令:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
[root@node01 ~]# docker exec -it kubeasz ezctl start-aio 2023-03-22 06:15:05 INFO get local host ipadd: 10.10.11.49 2023-03-22 06:15:05 DEBUG generate custom cluster files in /etc/kubeasz/clusters/default 2023-03-22 06:15:05 DEBUG set versions 2023-03-22 06:15:05 DEBUG disable registry mirrors 2023-03-22 06:15:05 DEBUG cluster default: files successfully created. 2023-03-22 06:15:05 INFO next steps 1: to config '/etc/kubeasz/clusters/default/hosts' 2023-03-22 06:15:05 INFO next steps 2: to config '/etc/kubeasz/clusters/default/config.yml' ansible-playbook -i clusters/default/hosts -e @clusters/default/config.yml playbooks/90.setup.yml 2023-03-22 06:15:05 INFO cluster:default setup step:all begins in 5s, press any key to abort:
PLAY [kube_master,kube_node,etcd,ex_lb,chrony] **********************************************************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************************************************************************************** fatal: [10.10.11.49]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: root@10.10.11.49: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).", "unreachable": true}
bash-5.1# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa already exists. Overwrite (y/n)? bash-5.1# ssh-copy-id root@10.10.11.49 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed expr: warning: '^ERROR: ': using '^' as the first character of a basic regular expression is not portable; it is ignored /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root@10.10.11.49's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@10.10.11.49'" and check to make sure that only the key(s) you wanted were added.
[root@node01 kubeasz]# docker exec -it kubeasz ezctl setup default all ansible-playbook -i clusters/default/hosts -e @clusters/default/config.yml playbooks/90.setup.yml 2023-03-22 07:35:46 INFO cluster:default setup step:all begins in 5s, press any key to abort:
PLAY [kube_master,kube_node,etcd,ex_lb,chrony] **********************************************************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************************************************************************************** fatal: [10.10.11.49]: FAILED! => {"msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"}
Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 41s default-scheduler Successfully assigned kube-system/calico-node-rqpjm to 10.10.11.49 Normal Pulling 20s (x2 over 31s) kubelet Pulling image "easzlab.io.local:5000/calico/cni:v3.23.5" Warning Failed 19s (x2 over 31s) kubelet Failed to pull image "easzlab.io.local:5000/calico/cni:v3.23.5": rpc error: code = Unknown desc = failed to pull and unpack image "easzlab.io.local:5000/calico/cni:v3.23.5": failed to resolve reference "easzlab.io.local:5000/calico/cni:v3.23.5": failed to do request: Head "https://easzlab.io.local:5000/v2/calico/cni/manifests/v3.23.5": http: server gave HTTP response to HTTPS client Warning Failed 19s (x2 over 31s) kubelet Error: ErrImagePull Normal BackOff 5s (x2 over 30s) kubelet Back-off pulling image "easzlab.io.local:5000/calico/cni:v3.23.5" Warning Failed 5s (x2 over 30s) kubelet Error: ImagePullBackOff
[root@node01 log]# docker pull easzlab.io.local:5000/calico/cni:v3.23.5 v3.23.5: Pulling from calico/cni Digest: sha256:9c5055a2b5bc0237ab160aee058135ca9f2a8f3c3eee313747a02edcec482f29 Status: Image is up to date for easzlab.io.local:5000/calico/cni:v3.23.5 easzlab.io.local:5000/calico/cni:v3.23.5
[root@node01 ~]# kubectl get pod -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system calico-kube-controllers-89b744d6c-klzwh 1/1 Running 0 5m35s kube-system calico-node-wmvff 1/1 Running 0 5m35s kube-system coredns-6665999d97-mp7xc 0/1 ContainerCreating 0 5m35s kube-system dashboard-metrics-scraper-57566685b4-8q5fm 0/1 ContainerCreating 0 5m35s kube-system kubernetes-dashboard-57db9bfd5b-h6jp4 0/1 ContainerCreating 0 5m35s kube-system metrics-server-6bd9f986fc-njpnj 0/1 ContainerCreating 0 5m35s kube-system node-local-dns-wz9bg 1/1 Running 0 5m31s
选择一个describe查看:
1 2 3 4 5 6 7
Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedScheduling 6m7s default-scheduler 0/1 nodes are available: 1 node(s) had untolerated taint {node.kubernetes.io/not-ready: }. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.. Normal Scheduled 5m47s default-scheduler Successfully assigned kube-system/coredns-6665999d97-mp7xc to 10.10.11.49 Warning FailedCreatePodSandBox 5m46s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "072c164d79f4874a8d851d36115ea04b75a2155dae3cecdc764e923c9f38f86b": plugin type="calico" failed (add): failed to find plugin "calico" in path [/opt/cni/bin] Normal SandboxChanged 33s (x25 over 5m46s) kubelet Pod sandbox changed, it will be killed and re-created.