kubernetes 1.20.0二进制包+flannel部署

原创
06/01 15:53
阅读数 687

kubernetes 1.20.0二进制包+flannel部署

二进制、镜像准备:
master:
kubeadm、kubectl、kubelet+cni二进制集合
kube-controller-manager
kube-scheduler
kube-apiserver
kube-proxy
pause
coredns
flannel
etcd

node001:
kubeadm、kubectl、kubelet+cni二进制集合
kube-proxy
flannel
pause
etcd

配置文件准备:
1、kubeadm配置文件
/usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf

2、kubelet配置文件
/usr/lib/systemd/system/kubelet.service

3、cni 二进制拷贝至opt/cni/bin目录下/master和node节点 flannel里面的command都有到该目录下找网络相关二进制

环境清理
  2 iptables -F && iptables -X && iptables -Z && iptables -L&&systemctl stop iptables&&systemctl status iptables
  3 swapoff -a;sed -i -e /swap/d /etc/fstab
  4 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
  5 setenforce 0
  6 rm -rf /etc/kubernetes
  7 rm -rf $HOME/.kube/config
  8 rm -rf /etc/cni/net.d
  9 rm -rf /var/lib/etcd
 10 rm -rf /root/.kube/config

kubeadm reset 
kubeadm reset 


部署流程:
master:
kubeadm init --config=/home/init_default.yaml

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
export KUBECONFIG=/etc/kubernetes/admin.conf

kubectl create -f kube-flannel.yml

node001:
kubeadm join 10.2.5.141:6443 --token abcdef.0123456789abcdef \
    --discovery-token-ca-cert-hash sha256:c94ac493be4982df3f77baf9aae56d873ffc7371d8585b838361fe93f9c6fe3b

部署结果:
kubectl get nodes -o wide 
NAME      STATUS   ROLES                  AGE   VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE                KERNEL-VERSION                  CONTAINER-RUNTIME
master    Ready    control-plane,master   15h   v1.20.0   10.130.0.111   <none>        Loongnix GNU/Linux 20   4.19.167-rc5.lnd.1-loongson-3   docker://20.10.3
node001   Ready    <none>                 13m   v1.20.0   10.130.0.115   <none>        Loongnix GNU/Linux 20   4.19.167-rc5.lnd.1-loongson-3   docker://20.10.3

kubectl get pods -A  -o wide 
NAMESPACE     NAME                             READY   STATUS    RESTARTS   AGE   IP             NODE      NOMINATED NODE   READINESS GATES
kube-system   coredns-78fbdddb88-ct4hl         1/1     Running   0          15h   10.244.0.2     master    <none>           <none>
kube-system   coredns-78fbdddb88-dhzxt         1/1     Running   0          15h   10.244.0.3     master    <none>           <none>
kube-system   etcd-master                      1/1     Running   0          15h   10.130.0.111   master    <none>           <none>
kube-system   kube-apiserver-master            1/1     Running   0          15h   10.130.0.111   master    <none>           <none>
kube-system   kube-controller-manager-master   1/1     Running   0          15h   10.130.0.111   master    <none>           <none>
kube-system   kube-flannel-ds-f6qlw            1/1     Running   0          15h   10.130.0.111   master    <none>           <none>
kube-system   kube-flannel-ds-jmgsb            1/1     Running   0          13m   10.130.0.115   node001   <none>           <none>
kube-system   kube-proxy-hcw4c                 1/1     Running   0          13m   10.130.0.115   node001   <none>           <none>
kube-system   kube-proxy-xfdbd                 1/1     Running   0          15h   10.130.0.111   master    <none>           <none>
kube-system   kube-scheduler-master            1/1     Running   0          15h   10.130.0.111   master    <none>           <none>
————————————————
版权声明:本文为CSDN博主「woainbadc」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/woainbadc/article/details/117435424

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部