K8S部署第二版 四.配置node节点加入master
按照命令跑一边就可以join。
kubeadm join 192.168.60.136:6443 --token pfqfd8.klsxy6wxo3rg2kzb \
--discovery-token-ca-cert-hash sha256:05c39bf9e8ef890faf2b984fe0dd446cc3a5d9687a053b8eba21955bf5152595
按照命令跑一边就可以join
hostnamectl set-hostname k8s-node1 k8s-node2
cat >> /etc/hosts << EOF
192.168.60.136 k8s-master
192.168.60.137 k8s-node1
192.168.60.138 k8s-node2
EOF
systemctl stop firewalld && systemctl disable firewalld
systemctl status firewalld
setenforce 0
getenforce
sed -i "s/SELINUX=enforcing/SELINUX=permissive/g" /etc/selinux/config
cat /etc/selinux/config
swapoff --version
swapoff -a
sed -ri 's/.*swap.*/#&/' /etc/fstab
swapon -v
free -m
swapon -a
cat /etc/sysconfig/network-scripts/ifcfg-ens33
cd /etc/yum.repos.d/ && mkdir bak && mv CentOS-* bak/
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
yum makecache fast
yum update -y
cat >> /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
yum install -y ntpdate
ntpdate time.windows.com
yum install -y gcc && yum install -y gcc-c++
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
yum install -y yum-utils
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl start docker && systemctl enable docker && systemctl status docker
docker version
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload && systemctl restart docker
cat >> /etc/yum.repos.d/kubernetes.repo << EOF
[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
yum install -y kubelet-1.18.0 kubeadm-1.18.0 kubectl-1.18.0
systemctl enable kubelet
更多推荐
所有评论(0)