1.三个节点:master,slave,client
在Kubernetes集群中,三个节点的职责分别如下:
Master节点:
docker:用于运行Docker容器。
etcd:一个分布式键值存储系统,用于保存Kubernetes集群的所有配置信息和状态数据。
kube-apiserver:负责处理集群中所有REST请求的API服务器,提供集群的API服务。
kube-scheduler:负责将Pod调度到合适的节点上,依据资源需求和策略。
kube-controller-manager:负责运行集群中的各类控制器,如ReplicationController、EndpointsController等,确保集群状态符合期望。
Slave节点:
docker:用于运行Docker容器。
flannel:网络插件,提供Pod间的网络连接。
kubelet:在每个节点上运行的代理,负责管理Pod和容器的生命周期。
kube-proxy:管理网络规则,处理服务和Pod之间的网络通信。
Client节点:
SSH客户端:用于连接到Master节点和Slave节点,执行管理和调度任务。可以使用如PuTTY、MobaXterm等SSH客户端工具。
总结:
Master节点是集群的控制中心,负责集群管理和调度。
Slave节点(工作节点)是实际运行Pod和容器的计算资源。
Client节点是用户或管理员的终端,提供与集群交互的界面。
2.master节点的环境配置
1)docker安装,这个看我之前文章有
2)安装Kubernetes组件
# 安装 kubeadm, kubelet, kubectl
sudo apt update
sudo apt install -y kubelet kubeadm kubectl
直接报错{
root@Genius4090:/home/cxh/demo# sudo apt install -y kubelet kubeadm kubectl
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成 无 apt 软件包 "kubeadm",但有一个同名的 snap 软件包
尝试 "snap install kubeadm"无 apt 软件包 "kubectl",但有一个同名的 snap 软件包
尝试 "snap install kubectl"无 apt 软件包 "kubelet",但有一个同名的 snap 软件包
尝试 "snap install kubelet"E: 无法定位软件包 kubelet
E: 无法定位软件包 kubeadm
E: 无法定位软件包 kubectl}
解决办法:{
https://blog.csdn.net/weixin_47613673/article/details/124003405?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171835408316800227497902%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=171835408316800227497902&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-124003405-null-null.142^v100^pc_search_result_base8&utm_term=ubuntu%E4%B8%8B%E8%BD%BDKubernetes&spm=1018.2226.3001.4187镜像加速器地址(https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors)
安装docker的教程(
https://blog.csdn.net/buxuehu6052/article/details/122102283?ops_request_misc=&request_id=&biz_id=102&utm_term=%20%20%E6%97%A0%E6%B3%95%E5%8F%91%E8%B5%B7%E4%B8%8E%20download.docker.com:44&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-122102283.nonecase&spm=1018.2226.3001.4187
)(https://blog.csdn.net/u010381752/article/details/114086343)}
2)安装etcd
# 下载 etcd 压缩包
wget https://github.com/etcd-io/etcd/releases/download/v3.5.8/etcd-v3.5.8-linux-amd64.tar.gz# 解压 etcd 压缩包
tar -xvf etcd-v3.5.8-linux-amd64.tar.gz# 复制 etcd 二进制文件到 /usr/local/bin
sudo cp etcd-v3.5.8-linux-amd64/etcd* /usr/local/bin/
sudo nano /etc/systemd/system/etcd.service
[Unit]
Description=etcd - highly-available key value store
Documentation=https://github.com/coreos/etcd
Conflicts=etcd.service
After=network.target[Service]
User=root
Type=notify
ExecStart=/usr/local/bin/etcd \\--name default \\--data-dir /var/lib/etcd \\--listen-client-urls http://0.0.0.0:2379 \\--advertise-client-urls http://0.0.0.0:2379
Restart=always
RestartSec=5
LimitNOFILE=40000[Install]
WantedBy=multi-user.target
sudo mkdir -p /var/lib/etcdsudo systemctl daemon-reload
sudo systemctl start etcd
sudo systemctl enable etcdsudo systemctl status etcd
3.slave节点的环境配置
1)windows系统安装docker教程
https://blog.csdn.net/Liuj666/article/details/126099982?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171858992116777224462430%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=171858992116777224462430&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_positive~default-1-126099982-null-null.142^v100^pc_search_result_base7&utm_term=windows%E5%AE%89%E8%A3%85docker&spm=1018.2226.3001.4187
ERROR:这里遇到一个问题,就是我的应用商店打不开,一直报错,在尝试解决
解决方法:关掉代理,将设置中的代理也关掉,然后会报一个更新的错误,错误代码0x80070422
解决办法:https://blog.csdn.net/qq_36286039/article/details/122679661?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171859455416800186593038%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=171859455416800186593038&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~rank_v31_ecpm-1-122679661-null-null.142^v100^pc_search_result_base8&utm_term=windows%E6%9C%8D%E5%8A%A1%E2%80%9C%E5%BA%94%E7%94%A8%E2%80%9D%E7%9A%84%E6%97%B6%E5%80%99%E6%8B%92%E7%BB%9D%E8%AE%BF%E9%97%AE%E5%8F%AF%E8%83%BD%E6%98%AF%E5%93%AA%E9%87%8C%E5%87%BA%E4%BA%86%E9%97%AE%E9%A2%98%EF%BC%9F&spm=1018.2226.3001.4187
然后安装好ubuntu后再次遇到错误Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x800701bc
Error: 0x800701bc WSL 2 ?????????????????? https://aka.ms/wsl2kernel
解决办法:
https://blog.csdn.net/u014098950/article/details/138278479?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171859514516800180669598%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=171859514516800180669598&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-138278479-null-null.142^v100^pc_search_result_base8&utm_term=Installing%2C%20this%20may%20take%20a%20few%20minutes...%20WslRegisterDistribution%20failed%20with%20error%3A%200x800701bc%20Error%3A%200x800701bc%20WSL%202%20%20https%3A%2F%2Faka.ms%2Fwsl2kernel&spm=1018.2226.3001.4187
错误:wsl update failed: update failed: updating wsl: exit code: 4294967295: running WSL command wsl.exe C:\Windows\System32\wsl.exe --update --web-download: HrCg@b g(c) Microsoft Corporation0�OYu@b gCg)R0
解决办法:https://blog.csdn.net/weixin_40101756/article/details/139153503?ops_request_misc=&request_id=&biz_id=102&utm_term=wsl%20update%20failed:%20update%20fail&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-139153503.nonecase&spm=1018.2226.3001.4187
最后以管理员身份打开docker desktop
2)Flannel了解
https://blog.csdn.net/huwh_/article/details/77899108?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171860559616800184139603%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=171860559616800184139603&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-77899108-null-null.142^v100^pc_search_result_base8&utm_term=flannel%E6%98%AF%E4%BB%80%E4%B9%88&spm=1018.2226.3001.4187
3)kube-proxy了解
https://blog.csdn.net/m0_57223716/article/details/125167416?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171861671516800227420557%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=171861671516800227420557&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_click~default-1-125167416-null-null.142^v100^pc_search_result_base8&utm_term=kube-proxy&spm=1018.2226.3001.4187
4)kubelet
https://blog.csdn.net/jettery/article/details/78891733?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171861701616800182137490%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=171861701616800182137490&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_positive~default-1-78891733-null-null.142^v100^pc_search_result_base8&utm_term=kubelet&spm=1018.2226.3001.4187
因为我发现我的这个windows系统不能安装kubelet什么的,也就不能充当Slave节点,只能等以后我把这个电脑重装个linux再实践k8s集群了
文章参考
https://mp.weixin.qq.com/s?__biz=MzU4ODI1MjA3NQ==&mid=2247483755&idx=1&sn=92a547c579aeacf1db9a8f0e56601b52&chksm=fdded7afcaa95eb9d6aa6cf323bff1df46692fc6a6672e0a483105f091ddf9670fb06d034e2a&scene=21#wechat_redirect