cento7.6安装kubernetes1.14.1
1 .準(zhǔn)備:兩臺虛擬機(jī)maste.lab.example.com 192.168.125.142 2cpu 2G 60G
node.lab.example.com 192.168.125.141 2cpu 4G 60G
更新軟件包 yum update -y
新增源 :cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak
curl -o CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/CentOS-Base.repo
curl -o docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
yum clean all && yum makecache
關(guān)閉selinux和firewalld
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
systemctl stop firewalld && systemctl disable firewalld
修改內(nèi)核參數(shù)
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl -p
加載內(nèi)核模塊
modprobe br_netfilter
lsmod | grep br_netfilter
禁用swap
swapoff -a
echo "vm.swappiness = 0">> /etc/sysctl.conf
sysctl -p
yum install docker-ce
設(shè)置鏡像加速器(這里我使用了自己個人的阿里云鏡像加速,根據(jù)個人實(shí)際情況來寫)
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://o9ofxrn0.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker && systemctl enable docker
由于國內(nèi)網(wǎng)絡(luò)已被墻,我在這里事先吧1.14.1的鏡像提供出來
鏈接:https://pan.baidu.com/s/1QkRoRHLFJxrQHAuslpFN4Q
提取碼:ovgt
復(fù)制這段內(nèi)容后打開百度網(wǎng)盤手機(jī)App,操作更方便哦
yum install -y kubelet kubeadm kubectl
注:我這里現(xiàn)在yum源中是1.14.1的版本,之后會有更新的版本,如果是更高或者是其他版本,我這里提供的鏡像就不能用了。
kubeadm init --pod-network-cidr=10.244.0.0/16
跑完上面的init命令后會看到類似如下的輸出:
Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join 192.168.125.142:6443 --token 5fasbl.ctmnsuq04udlb8t2 \
--discovery-token-ca-cert-hash sha256:c7fea93fa4ebcc695a48720fb007185102167bbd7f7ff9d2be178efdee20dad0
接下來你懂的,該怎么做!!!
轉(zhuǎn)載于:https://blog.51cto.com/ivanfcl/2392421
總結(jié)
以上是生活随笔為你收集整理的cento7.6安装kubernetes1.14.1的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 30 天精通 RxJS (01):认识
- 下一篇: 云计算大趋势