解决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 ................................
相关推荐
AAA小肥杨3 小时前
基于k8s的Python的分布式深度学习训练平台搭建简单实践
人工智能·分布式·python·ai·kubernetes·gpu
爬山算法6 小时前
Redis(73)如何处理Redis分布式锁的死锁问题?
数据库·redis·分布式
xiaogg36787 小时前
阿里云k8s1.33部署yaml和dockerfile配置文件
java·linux·kubernetes
2503_930123937 小时前
Kubernetes (四)网络插件详解:Flannel 与 Calico 的原理、数据流向与实战对比
网络·容器·kubernetes
祈祷苍天赐我java之术8 小时前
Redis 数据类型与使用场景
java·开发语言·前端·redis·分布式·spring·bootstrap
K_i1348 小时前
K8s 运维三大核心难题:DNS 故障、有状态存储、AI 赋能 SRE 解决方案
kubernetes
猫林老师10 小时前
HarmonyOS线程模型与性能优化实战
数据库·分布式·harmonyos
远向光11 小时前
k8s中的控制器
linux·容器·kubernetes
安卓开发者13 小时前
Docker常用镜像使用指南:从入门到实战
运维·docker·容器
霖.2414 小时前
Docker常见问题
服务器·docker·云原生·容器