windows 10 安装K8S
创建两个文件
images.properties
k8s.gcr.io/pause:3.1=registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.1 k8s.gcr.io/kube-controller-manager:v1.18.3=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.18.3 k8s.gcr.io/kube-scheduler:v1.18.3=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.18.3 k8s.gcr.io/kube-proxy:v1.18.3=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.18.3 k8s.gcr.io/kube-apiserver:v1.18.3=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.18.3 k8s.gcr.io/etcd:3.3.15-0=registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.3.15-0 k8s.gcr.io/coredns:1.6.2=registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:1.6.2 quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.26.1=registry.cn-hangzhou.aliyuncs.com/google_containers/nginx-ingress-controller:0.26.1
下面不要使用(最新无效)
k8s.gcr.io/pause:3.2=registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.2
k8s.gcr.io/kube-controller-manager:v1.17.5=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.17.5
k8s.gcr.io/kube-scheduler:v1.17.6=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.17.6
k8s.gcr.io/kube-proxy:v1.17.5=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.17.5
k8s.gcr.io/kube-apiserver:v1.17.6=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.17.6
k8s.gcr.io/etcd:3.4.7=registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.4.7
k8s.gcr.io/coredns:1.6.7=registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:1.6.7
quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.31.1=registry.cn-hangzhou.aliyuncs.com/google_containers/nginx-ingress-controller:0.31.1
load_images.ps1
foreach($line in Get-Content .\images.properties) { $data = $line.Split('=') $key = $data[0]; $value = $data[1]; Write-Output "$key=$value" docker pull ${value} docker tag ${value} ${key} docker rmi ${value} }
Power shell 运行
.\load_images.ps1
docker desktop 勾选 Enable Kubernetes 并应用
Linux 用 load_images.sh
#!/bin/bash file="images.properties" if [ -f "$file" ] then echo "$file found." while IFS='=' read -r key value do #echo "${key}=${value}" docker pull ${value} docker tag ${value} ${key} docker rmi ${value} done < "$file" else echo "$file not found." fi
./load_images.sh