Kubernetes環境搭建之 FAQ for nodes

1.在執行下面添加node命令時, 出現下面的截圖

kubeadm join 192.168.1.104:6443 --token 8cglur.h4iscdcgzmerrz4y --discovery-token-ca-cert-hash sha256:b86075b9079b21878b75fc7e18be29939605dfac66da58b6a2d216898bb9218e

裴星宙(DanielPei) Kubernetes 環境搭建之FAQ for nodes
主要錯誤信息爲

        [WARNING Hostname]: hostname "k8s-daniel-2.novalocal" could not be reached
        [WARNING Hostname]: hostname "k8s-daniel-2.novalocal": lookup k8s-daniel-2.novalocal on 10.32.148.99:53: no such host
        [WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
[preflight] Some fatal errors occurred:
        [ERROR CRI]: container runtime is not running: output: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
, error: exit status 1
        [ERROR Service-Docker]: docker service is not active, please run 'systemctl start docker.service'
        [ERROR FileContent--proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables does not exist
        [ERROR FileContent--proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1
        [ERROR SystemVerification]: failed to get docker info: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`

  • 問題解決
    – hostnamectl set-hostname k8s-daniel-1
    – systemctl start docker.service
    – echo 1 >/proc/sys/net/ipv4/ip_forward
    – echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
    – systemctl enable docker.service
    – systemctl enable kubelet.service
    – kubeadm join 192.168.1.104:6443 --token 8cglur.h4iscdcgzmerrz4y --discovery-token-ca-cert-hash sha256:b86075b9079b21878b75fc7e18be29939605dfac66da58b6a2d216898bb9218e

2.無法連接到master 6443端口

  • a. 在執行kubeadm join時,遇到下面的問題
    裴星宙(DanielPei) Kubernetes 環境搭建之FAQ for nodes
  • b. solution
    • 檢查master是否有防火牆, 如果有防火牆, 關閉防火牆
systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state
systemctl status firewalld.servic
    • 重啓kubelet服務
systemctl restart kubelet
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章