kubernetes部署

2020-05-06  本文已影响0人  周识儒ice


docker安装



关闭防火墙、设置SeLinux、关闭swap


systemctl stop firewalld

systemctl disable firewalld

setenforce 0

sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

swapoff -a

cp /etc/fstab /etc/fstab_tmp

cat /etc/fstab_tmp |grep -v swap > /etc/fstab

安装 kubelet kubectl kubeadm   并将 kubelet 设置为开机自启动

yum install -y kubelet-1.18.0 kubeadm-1.18.0 kubectl-1.18.0

systemctl enable kubelet

master点初始化,注意主机IP 和 kubernetes version

kubeadm init \--apiserver-advertise-address=192.168.2.241 \--image-repository registry.aliyuncs.com/google_containers \--kubernetes-version v1.18.0 \--service-cidr=10.1.0.0/16 \--pod-network-cidr=10.244.0.0/16

master节点初始化过程中遇到超时的情况,可能是iptables规则未清除

swapoff -a && kubeadm reset && systemctl daemon-reload && systemctl restart kubelet && iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X

master节点安装flannel网络插件,

kube-flannel.yml 文件下载地址:https://pan.baidu.com/s/1V3cmQRhUKyqNGlYjlwmqXQ 提取码: m4ca 

kubectl apply -f kube-flannel.yml

node节点执行join命令

kubeadm join 192.168.2.241:6443 --token nwxvya.lyaplfoh7ib35ot1 \ --discovery-token-ca-cert-hash sha256:d7b25854b0d0d7715659f8523d807e82d9ea81b76279c9c4e5003b573dbde30c

kubernetes 知识图谱

https://www.processon.com/view/link/5ac64532e4b00dc8a02f05eb?spm=a2c4e.10696291.0.0.6ec019a4bYSFIw#map

上一篇下一篇

猜你喜欢

热点阅读