解决k8s分布式集群,子节点加入到主节点失败的问题

1.问题情况

Master主节点在 使用 kubeadm init 成功进行初始化后,如下所示

复制代码
Your Kubernetes control-plane has initialized successfully!

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

Alternatively, if you are the root user, you can run:

  export KUBECONFIG=/etc/kubernetes/admin.conf

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 control-plane nodes by copying certificate authorities
and service account keys on each node and then running the following as root:

  kubeadm join cluster-endpoint:6443 --token k5fx27.0lio5aod7s8b03md \
    --discovery-token-ca-cert-hash sha256:44dbbd0bb7495be1eb25f78a21103e0b52857df4671bab577af0f5e11ba6f7f1 \
    --control-plane

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join cluster-endpoint:6443 --token k5fx27.0lio5aod7s8b03md \
    --discovery-token-ca-cert-hash sha256:44dbbd0bb7495be1eb25f78a21103e0b52857df4671bab577af0f5e11ba6f7f1

但是子节点在使用 join cluster-endpoint加入到集群时报错

2.解决方法

两台子节点在加入集群时出错,通过docker 的配置文件daemon.json 内容

将内容删除 修改至 只有 mirrors镜像配置 如上图所示 保存后重启docker

复制代码
#在子节点运行
#重启docker
systemctl stop docker
systemctl daemon-reload
systemctl restart docker

#重置 子节点的集群加载配置
kubeadm reset

#重新加入主节点集群
kubectl join cluster-endpoint:8888 ................................
相关推荐
键盘鼓手苏苏20 小时前
Kubernetes与GitOps高级实践
云原生·kubernetes·k8
不是书本的小明20 小时前
K8S应用优化方向
网络·容器·kubernetes
凌乱的豆包1 天前
Spring Cloud Alibaba Nacos 服务注册发现和分布式配置中心
分布式
andeyeluguo1 天前
docker总结
运维·docker·容器
SuAluvfy1 天前
从 0 到 1:在 Windows + Docker 环境下搭建 NextChat 并接入多模型 API(踩坑实录)
docker·容器
九英里路1 天前
cpp容器——string模拟实现
java·前端·数据结构·c++·算法·容器·字符串
尘世壹俗人1 天前
知识点8---虚拟化编排工具Kubernetes
容器·kubernetes
独隅1 天前
PyTorch 分布式训练完整指南:策略、实现与模型选型
人工智能·pytorch·分布式
冷色系里的一抹暖调1 天前
OpenClaw Docker 部署避坑指南:服务启动成功但网页打不开?
人工智能·windows·docker·ai·容器·opencode
@土豆1 天前
acme.sh 自动解析、申请并续签免费泛域名证书(Docker容器部署+腾讯云DNSPod)
docker·容器·腾讯云