K8S v1.18.x 部署-Kubeadm方式-3:部署工具
作者:互联网
安装kubeadm、kubelet、kubectl
安装检查
确保MAC唯一性
- MAC地址
ip link or ifconfig -a
- product_uuid
cat /sys/class/dmi/id/product_uuid
**检查网络适配器**
确保网络可连通,路由配置正确。
**检查所需端口可用**
控制平面节点:
![](http://www.icode9.com/i/li/?n=4&i=images/blog/202103/13/35856afa1341b7f2298e3f4d0eeb4a35.png?,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
工作平面节点:
![](http://www.icode9.com/i/li/?n=4&i=images/blog/202103/13/6fb9e1fdffc68d5fa42e49c87173f832.png?,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
**确认节点上的Container Runtime**
Kubeadm可检测到容器运行时:
![](http://www.icode9.com/i/li/?n=4&i=images/blog/202103/13/0c2d7c9dec8c55a114808d71152d6f90.png?,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
如果同时检测到docker和containerd,则优先选择docker。
kubelet通过内置的dockershim CRI实现与Docker集成。
**准备安装源**
除了LB节点之外,其他节点都需要该安装源。
配置kubernetes软件yum源
$ cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
**安装kubeadm、kubelet、kubectl**
Master节点和Node节点安装。
查看yum上的kubernetes版本,这里最新版本是1.18.4-1.x86_64
$ yum search kubeadm --showduplicates
...
kubeadm-1.18.6-0.x86_64 : Command-line utility for administering a Kubernetes cluster.
kubeadm-1.18.8-0.x86_64 : Command-line utility for administering a Kubernetes cluster.
kubeadm-1.19.0-0.x86_64 : Command-line utility for administering a Kubernetes cluster.
[root@K8S-TEST-M1 yum.repos.d]# yum search kubelet --showduplicates
...
kubelet-1.18.6-0.x86_64 : Container cluster management
kubelet-1.18.8-0.x86_64 : Container cluster management
kubelet-1.19.0-0.x86_64 : Container cluster management
[root@K8S-TEST-M1 yum.repos.d]# yum search kubectl --showduplicates
...
kubectl-1.18.6-0.x86_64 : Command-line utility for interacting with a Kubernetes cluster.
kubectl-1.18.8-0.x86_64 : Command-line utility for interacting with a Kubernetes cluster.
kubectl-1.19.0-0.x86_64 : Command-line utility for interacting with a Kubernetes cluster.
安装kubernetes组件
$ yum install -y kubeadm-1.18.8-0.x86_64 kubelet-1.18.8-0.x86_64 kubectl-1.18.8-0.x86_64
**配置kubelet**
配置kubelet使用的cgroup驱动:
默认kubelet的配置文件位于:/etc/sysconfig/kubelet。建议删除该文件。使用Docker时,kubeadm将自动检测kubelet的cgroup驱动程序,可在节点部署完毕后修改/var/lib/kubelet/config.yaml来设置kubelet的cgroup驱动程序。文件内容:
...
apiVersion: kubelet.config.k8s.io/v1beta1
...
kind: KubeletConfiguration
...
cgroupDriver: systemd
...
启动kubelet
systemctl daemon-reload && systemctl enable kubelet && systemctl start kubelet && syste
标签:v1.18,x86,cluster,部署,1.18,kubelet,64,yum,Kubeadm 来源: https://blog.51cto.com/15127525/2658797