前提:記得翻牆
一、配置映象源
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google...
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google...
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
二、關閉setenforce
setenforce 0
三、安裝
yum install -y docker kubelet kubeadm kubectl kubernetes-cni
四、啟動服務
systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet
五、初始化
kubeadm init
可能遇到的問題:
1. [preflight] Some fatal errors occurred:
/proc/sys/net/bridge/bridge-nf-call-iptables contents are not set to 1
解決方案:
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables
五、常見問題