一. 安裝Docker
第一步:更新系統軟體包索引
sudo apt update
第二步:安裝必要依賴包
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common
第三步:新增Docker官方GPG金鑰
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
第四步:新增Docker的APT源
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
第五步:更新軟體包列表並安裝Docker
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
二. K8S
考慮網路問題,這裡透過阿里雲的Kubernetes軟體源安裝,可以這樣做:
首先,匯入阿里雲的apt-key:
curl -s https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add -
接著,新增阿里雲的Kubernetes APT源到系統中:
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
最後,更新軟體包列表並安裝Kubernetes元件:
sudo apt update
sudo apt install -y kubelet kubeadm kubectl