kubeadm init 时从本地私有仓库下载镜像

1. 脚本auto_deploy_k8s.sh

images=(
gcr.io/google_containers/kube-proxy-amd64:v1.6.1 
gcr.io/google_containers/kube-apiserver-amd64:v1.6.1 
gcr.io/google_containers/kube-scheduler-amd64:v1.6.1 
gcr.io/google_containers/kube-controller-manager-amd64:v1.6.1 
gcr.io/google_containers/kube-proxy-amd64:v1.6.0 
gcr.io/google_containers/kube-controller-manager-amd64:v1.6.0 
gcr.io/google_containers/kube-apiserver-amd64:v1.6.0 
gcr.io/google_containers/kube-scheduler-amd64:v1.6.0 
gcr.io/google_containers/kubernetes-dashboard-amd64:v1.6.0 
gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.1 
gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.1 
gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.1 
gcr.io/google_containers/etcd-amd64:3.0.17 
quay.io/coreos/flannel:v0.7.0-amd64 
gcr.io/google_containers/pause-amd64:3.0
)

for imageName in ${images[@]} ; 
do
    docker pull gcr.io/google_containers/$imageName;
    docker tag gcr.io/google_containers/$imageName docker.cinyi.com:443/senyint/$imageName;
    docker push docker.cinyi.com:443/senyint/$imageName;
done

2. 推送k8s镜像到本地私有镜像库

# chmod +x auto_deploy_k8s.sh

# ./auto_deploy_k8s.sh

3. 修改相关配置文件

为kubelet添加一个额外的参数,在启动pod时,kubelet就不会去墙外的k8s仓库拉取pause-amd64:3.0镜像了。

# vim /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

--pod-infra-container-image=docker.cinyi.com:443/senyint/pause-amd64:3.0        

Environment="KUBELET_INFRA_IMAGE=--pod-infra-container-image=docker.cinyi.com:443/senyint/pause-amd64:3.0"

你可能感兴趣的:(K8S)