当前位置:网站首页>kubernetes 二进制安装(v1.20.15)(七)加塞一个工作节点
kubernetes 二进制安装(v1.20.15)(七)加塞一个工作节点
2022-06-11 12:53:00 【看、未来】
文章目录
k8s-node1 加入集群
分发文件
#此操作在Master(k8s-master)上进行
#分发kubernetes工作目录
scp -r /opt/kubernetes k8s-node1:/opt/
#分发kubelet,kube-proxy的管理文件
scp -r /usr/lib/systemd/system/{kubelet,kube-proxy}.service k8s-node1:/usr/lib/systemd/system
#分发证书文件
scp /opt/kubernetes/ssl/ca.pem k8s-node1:/opt/kubernetes/ssl
#替换kubelet.conf文件
scp /opt/TLS/k8s/cfg/kubelet02.conf k8s-node1:/opt/kubernetes/cfg/kubelet.conf
#替换kube-proxy-config.yml
scp /opt/TLS/k8s/cfg/kube-proxy-config02.yml k8s-node1:/opt/kubernetes/cfg/kube-proxy-config.yml
#删除kubelet证书和kubeconfig文件
ssh k8s-node1 "rm -f /opt/kubernetes/cfg/kubelet.kubeconfig"
ssh k8s-node1 "rm -f /opt/kubernetes/ssl/kubelet*"这里我再说一遍 TLS Bootstrapping:算了下一篇吧,这里之所以要删除这两个文件,是因为要从 master 的 apiserver 重新生成,如果有东西在那边,会导致一些莫名其妙的后果,比方说 kubelet 起来了,但是从master 上扫描不到 node。
如果有想重新安装 kubelet,记得要将那两个地方清理一下,不然会很有意思…
核对文件
#此操作在k8s-node1上进行
[[email protected] ~]# ll /opt/kubernetes
total 12
drwxr-xr-x 2 root root 114 Apr 3 15:47 bin
drwxr-xr-x 2 root root 4096 Apr 3 15:48 cfg
drwxr-xr-x 2 root root 4096 Apr 3 15:47 logs
drwxr-xr-x 2 root root 4096 Apr 3 15:48 ssl
[[email protected] ~]# ll /usr/lib/systemd/system/{kubelet,kube-proxy}.service
-rw-r--r-- 1 root root 246 Apr 3 15:47 /usr/lib/systemd/system/kubelet.service
-rw-r--r-- 1 root root 253 Apr 3 15:47 /usr/lib/systemd/system/kube-proxy.service
[[email protected] ~]# ll /opt/kubernetes/ssl/ca.pem
-rw-r--r-- 1 root root 1310 Apr 3 15:47 /opt/kubernetes/ssl/ca.pem
[[email protected] ~]# ll /opt/kubernetes/cfg/kubelet.conf
-rw-r--r-- 1 root root 382 Apr 3 15:48 /opt/kubernetes/cfg/kubelet.conf
[[email protected] ~]# cat /opt/kubernetes/cfg/kubelet.conf
KUBELET_OPTS="--logtostderr=false \
--v=2 \
--log-dir=/opt/kubernetes/logs \
--hostname-override=k8s-node1 \
--network-plugin=cni \
--kubeconfig=/opt/kubernetes/cfg/kubelet.kubeconfig \
--bootstrap-kubeconfig=/opt/kubernetes/cfg/bootstrap.kubeconfig \
--config=/opt/kubernetes/cfg/kubelet-config.yml \
--cert-dir=/opt/kubernetes/ssl \
--pod-infra-container-image=ibmcom/pause-amd64:3.1"
[[email protected] ~]# ll /opt/kubernetes/cfg/kube-proxy-config.yml
-rw-r--r-- 1 root root 320 Apr 3 15:48 /opt/kubernetes/cfg/kube-proxy-config.yml
[[email protected] ~]# cat /opt/kubernetes/cfg/kubelet.conf
KUBELET_OPTS="--logtostderr=false \
--v=2 \
--log-dir=/opt/kubernetes/logs \
--hostname-override=k8s-node1 \
--network-plugin=cni \
--kubeconfig=/opt/kubernetes/cfg/kubelet.kubeconfig \
--bootstrap-kubeconfig=/opt/kubernetes/cfg/bootstrap.kubeconfig \
--config=/opt/kubernetes/cfg/kubelet-config.yml \
--cert-dir=/opt/kubernetes/ssl \
--pod-infra-container-image=ibmcom/pause-amd64:3.1"
[[email protected] ~]# cat /opt/kubernetes/cfg/kube-proxy-config.yml
kind: KubeProxyConfiguration
apiVersion: kubeproxy.config.k8s.io/v1alpha1
bindAddress: 0.0.0.0
metricsBindAddress: 0.0.0.0:10249
clientConnection:
kubeconfig: /opt/kubernetes/cfg/kube-proxy.kubeconfig
hostnameOverride: k8s-node1
clusterCIDR: 10.244.0.0/16
mode: ipvs
ipvs:
scheduler: "rr"
iptables:
masqueradeAll: true
[[email protected] ~]# ll /opt/kubernetes/cfg/kubelet.kubeconfig
ls: cannot access /opt/kubernetes/cfg/kubelet.kubeconfig: No such file or directory
[[email protected] ~]# ll /opt/kubernetes/ssl/kubelet*
ls: cannot access /opt/kubernetes/ssl/kubelet*: No such file or directory注:bootstrap.kubeconfig 那里面是 master 的地址。
启动kubelet
#此操作在k8s-node1上进行
[[email protected] ~]# systemctl daemon-reload && systemctl start kubelet && systemctl enable kubelet && systemctl status kubelet
....批准新Node证书申请
#此操作在Master(k8s-master)上进行
#查看新的证书请求,状态为Pending
[[email protected] cfg]# kubectl get csr
NAME AGE SIGNERNAME REQUESTOR REQUESTEDDURATION CONDITION
node-csr-6mDDHTg4HuOsVY_7oJRUqtS-6YQFe7JytpYdbRs9kek 31m kubernetes.io/kube-apiserver-client-kubelet kubelet-bootstrap <none> Approved,Issued
node-csr-ktjmR4VegWx92ELE3IskISfkdatpXBTKBrq8ZOCVObc 56s kubernetes.io/kube-apiserver-client-kubelet kubelet-bootstrap <none> Pending
#批准新的请求,并加入集群
[[email protected] cfg]# kubectl certificate approve node-csr-ktjmR4VegWx92ELE3IskISfkdatpXBTKBrq8ZOCVObc
certificatesigningrequest.certificates.k8s.io/node-csr-ktjmR4VegWx92ELE3IskISfkdatpXBTKBrq8ZOCVObc approved
#查看证书批准状态
[[email protected] cfg]# kubectl get csr
NAME AGE SIGNERNAME REQUESTOR REQUESTEDDURATION CONDITION
node-csr-6mDDHTg4HuOsVY_7oJRUqtS-6YQFe7JytpYdbRs9kek 31m kubernetes.io/kube-apiserver-client-kubelet kubelet-bootstrap <none> Approved,Issued
node-csr-ktjmR4VegWx92ELE3IskISfkdatpXBTKBrq8ZOCVObc 75s kubernetes.io/kube-apiserver-client-kubelet kubelet-bootstrap <none> Approved,Issued
#查看集群节点
[[email protected] cfg]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master NotReady <none> 30m v1.23.4
k8s-node1 NotReady <none> 14s v1.23.4
# 由于网络插件还没有部署,节点会没有准备就绪 NotReady启动kube-proxy
[[email protected] ~]# systemctl daemon-reload && systemctl start kube-proxy && systemctl enable kube-proxy && systemctl status kube-proxy边栏推荐
- What are the advantages of comprehensive venues?
- TeaTalk·Online 演讲实录 | 圆满完结!安全上云,选对数据迁移策略很重要
- From quic to TCP
- Master-slave replication of MySQL
- Why are the current membership warehouse stores bursting out collectively?
- [clearos] install the clearos system
- 苹果将造搜索引擎?
- 火山引擎云数据库 veDB 在字节内部的业务实践
- QQ pulls up Alipay H5 payment function
- Development of smart contract DAPP system for TRX wave field chain
猜你喜欢

火山引擎云数据库 veDB 在字节内部的业务实践

Seckill multi-level cache ----- product details page

4K投影仪哪款性价比最高,当贝X3 Pro高亮128G存储618值得看

换种方式实现阖家团圆,2022旗舰投影坚果J10S被种草

Dbutil auxiliary class, manual commit transaction, metadata

pip2pi和pypiserver及Apache在pip本地源配置中的应用实践

室内场馆现代化的三大要点

Zhongfu Jinshi: with the rapid development of the intelligent bathroom industry, the intelligent toilet will usher in a highlight moment

Ways to double the summer performance of natatoriums

How can mechanical equipment manufacturing enterprises manage outsourcing with the help of ERP system?
随机推荐
Development of smart contract DAPP system for TRX wave field chain
漫谈软件缺陷与漏洞
想要实现在时序场景下“远超”通用数据库,需要做到哪几点?
Application of "knowing things by learning" behavior time series modeling in the identification of social drainage black production
SQL的语法
详解C语言实参与形参的区别
Node creates a template file with the art template template template engine
Audio adaptation of openharmony Standard System Porting
Research on DB2 Database Reconstruction and table data migration
Kehai Rongsheng & zhenghang will jointly welcome the future of digital intelligence with informatization driven management upgrading
4K投影仪哪款性价比最高,当贝X3 Pro高亮128G存储618值得看
美容院管理系统如何解决门店运营的三大难题?
Tawang food industry insight | China's dairy market analysis, competition pattern, development trend and thinking
31w赛题奖金!当 AI for Science 撞上“先导杯”,会擦出什么样的火花?
Number selection (greed)
Adobe Premiere基础-批量素材导入序列-变速和倒放(回忆)-连续动作镜头切换-字幕要求(十三)
Mctalk's entrepreneurial voice - erudition and discernment: be interested in socializing, and provide a "small and beautiful" space for old friends before and after retirement
Master-slave replication of MySQL
From quic to TCP
What are the ways for badminton halls to generate income