【发布时间】:2019-04-18 21:21:49
【问题描述】:
在 ubuntu 18.06 上配置运行 kubeadm 的 K8S 时遇到问题。
在 master 1 节点上执行 kubeadm-init 后一切顺利:
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join 172.40.0.10:6443 --token oormjp.gf43botx19purn13 --discovery-token-ca-cert-hash sha256:5e9c917221233fdae445640415fac123204f41d31d072cd06545055187c860e2
所以我在执行以下命令后执行:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
export KUBECONFIG=/etc/kubernetes/admin.conf
当我测试 kubeclt 版本时,我得到:
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"clean", BuildDate:"2019-02-28T13:37:52Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
Unable to connect to the server: EOF
当我想安装编织或法兰绒等 CNI 时,我得到:
无法连接到服务器:EOF
这是 kubeadm 使用的我的 yaml 配置文件:
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: stable
apiServer:
certSANs:
- "172.40.0.10"
controlPlaneEndpoint: "172.40.0.10:6443"
networking:
podSubnet: 10.244.0.0/16
172.40.0.10 : 是一个 HAProxy 服务器。
谁能帮我调试一下?
【问题讨论】:
-
我已经测试了这个命令并得到:root@dk8s-m1:~# kubeadm init --apiserver-advertise-address $(hostname -i) --pod-network-cidr 10.244 .0.0/16 [init] 使用 Kubernetes 版本:v1.13.4 [preflight] 运行 pre-flight 检查错误执行阶段 preflight:[preflight] 发生一些致命错误:[ERROR FileContent--proc-sys-net-ipv6-conf- default-forwarding]: /proc/sys/net/ipv6/conf/default/forwarding 内容未设置为 1 [preflight] 如果您知道自己在做什么,可以使用
--ignore-preflight-errors=...进行非致命检查我> -
--apiserver-advertise-address $(hostname -i) 有什么作用?
-
$(hostname -i) 命令将填充机器的 IP 地址
-
嗨@SebHO,您尝试过P Ekambaram 提供的解决方案吗?请发表评论或提供任何反馈。你能运行这些命令并收集更多信息吗?
systemctl status kubelet和journalctl -u kubelet
标签: kubernetes kubeadm