centos7.6部署k8s 1.15.3
禁用swapsudo swapoff -asudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab禁用selinuxsetenforce 0sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config禁用防火墙systemctl stop firewalld...
·
禁用swap
sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
禁用selinux
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
禁用防火墙
systemctl stop firewalld
systemctl disable firewalld
安装docker
yum -y install docker
systemctl daemon-reload
systemctl enable docker
systemctl start docker
安装Kubernetes repo
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=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
yum clean all
安装 kubelet kubeadm kubectl kubernetes-cni
yum -y install kubelet kubeadm kubectl kubernetes-cni
systemctl daemon-reload
systemctl enable kubelet && systemctl start kubelet
使用kubeadm安装Kubernetes
kubeadm init --kubernetes-version=v1.15.3
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
检查集群状态
kubectl get cs
kubectl get nodes
kubectl get pods -n kube-system
单节点部署需要去除master污点
kubectl taint nodes --all node-role.kubernetes.io/master-
网络插件安装
kubectl apply -f https://git.io/weave-kube-1.6
kubectl get pods -n kube-system
kubectl get nodes
工作节点添加(kubeadm init执行后最后的提示信息)
kubeadm join 192.168.130.11:6443 --token xfq242.iohc2w0arp6pgf0d \
--discovery-token-ca-cert-hash sha256:416ea7c6dc1808e270d59bf841adac6f1c527b358fef6acc29826006fdcbf737
kubectl get node
kubectl label node node-x node-role.kubernetes.io/worker=worker
重新安装
kubeadm reset
echo "1" > /proc/sys/net/ipv4/ip_forward
更多推荐
已为社区贡献4条内容
所有评论(0)