Ubuntu 安装 k8s 笔记

#!/usr/bin/env bash
set -e

# 安装kubelet kubeadm kubectl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://mirrors.tuna.tsinghua.edu.cn/kubernetes/apt kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt install -y kubelet kubeadm kubectl

# 拉取镜像
kube_containers=(
  k8s.gcr.io/kube-apiserver:v1.20.2
  k8s.gcr.io/kube-controller-manager:v1.20.2
  k8s.gcr.io/kube-scheduler:v1.20.2
  k8s.gcr.io/kube-proxy:v1.20.2
  k8s.gcr.io/pause:3.2
  k8s.gcr.io/etcd:3.4.13-0
  k8s.gcr.io/coredns:1.7.0
)

for rec_container in ${kube_containers[*]}; do
  echo "$rec_container"
  ali_img="${rec_container//k8s.gcr.io/registry.cn-hangzhou.aliyuncs.com\/google_containers}"
  docker pull "$ali_img"
  docker tag "$ali_img" "$rec_container"
  docker rmi "$ali_img"
  echo -e "\033[41;37m$rec_container pull complete.\033[0m"
done

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐