Docker 快速上手 #
安装 #
登陆阿里云镜像仓库 #
docker login [email protected] registry.cn-shanghai.aliyuncs.com
- 密码:阿里云密码
拉取 k8s.gcr.io
镜像:
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.20.8
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.20.8 k8s.gcr.io/kube-apiserver:v1.20.8
docker rmi -f registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.20.8
# 遇到 aliyun 没有的,可以直接在 https://hub.docker.com/ 搜索
docker pull bitnami/kube-state-metrics:2.1.1
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[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.20.8 kubeadm-1.20.8 kubectl-1.20.8
systemctl enable kubelet && systemctl start kubelet
url=registry.cn-hangzhou.aliyuncs.com/google_containers
version=v1.20.8
images=(`kubeadm config images list --kubernetes-version=$version|awk -F '/' '{print $2}'`)
for imagename in ${images[@]} ; do
docker pull $url/$imagename
docker tag $url/$imagename k8s.gcr.io/$imagename
docker rmi -f $url/$imagename
done
叶王 © 2013-2024 版权所有。如果本文档对你有所帮助,可以请作者喝饮料。