一. 安装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
posted on 2024-04-23 20:04  黑熊一只  阅读(163)  评论(0编辑  收藏  举报