gpt4 book ai didi

docker - 运行 `minikube start` ,无法拉取 k8s.gcr 镜像,但 `docker pull` 可以

转载 作者:行者123 更新时间:2023-12-02 09:34:46 59 4
gpt4 key购买 nike

我尝试通过 minikube 运行 k8s,我遵循 offical article ,当我尝试 minikube start 命令时,错误说我无法拉取 docker 镜像(k8s.gcr):

tianyu@ubuntu:~$ minikube start
😄 minikube v0.34.1 on linux (amd64)
🔥 Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
📶 "minikube" IP address is 192.168.99.100
🌐 Found network options:
▪ HTTP_PROXY=http://127.0.0.1:35033
▪ HTTPS_PROXY=http://127.0.0.1:35033/
▪ NO_PROXY=localhost,127.0.0.0/8,::1
🐳 Configuring Docker as the container runtime ...
✨ Preparing Kubernetes environment ...
🚜 Pulling images required by Kubernetes v1.13.3 ...
❌ Unable to pull images, which may be OK: running cmd: sudo kubeadm config images pull --config /var/lib/kubeadm.yaml: command failed: sudo kubeadm config images pull --config /var/lib/kubeadm.yaml
stdout:
stderr: failed to pull image "k8s.gcr.io/kube-apiserver:v1.13.3": output: Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
, error: exit status 1
: Process exited with status 1
🚀 Launching Kubernetes v1.13.3 using kubeadm ...
💣 Error starting cluster: kubeadm init:
sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests --ignore-preflight-errors=DirAvailable--data-minikube --ignore-preflight-errors=Port-10250 --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-etcd.yaml --ignore-preflight-errors=Swap --ignore-preflight-errors=CRI

[init] Using Kubernetes version: v1.13.3
[preflight] Running pre-flight checks
[WARNING Service-Docker]: docker service is not enabled, please run 'systemctl enable docker.service'
[WARNING Swap]: running with swap on is not supported. Please disable swap
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-apiserver:v1.13.3: output: Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
, error: exit status 1
[ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-controller-manager:v1.13.3: output: Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
, error: exit status 1
[ERROR ImagePull]: failed to pull image k8s.gcr.io/kube-scheduler:v1.13.3: output: Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
....
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`

: Process exited with status 1

我在中国,所以我通过VPN访问gcr docker hub。我点击了这个链接(https://docs.docker.com/config/daemon/systemd/#httphttps-proxy),所以我可以通过docker拉取图像(k8s.gcr)。信息如下:

tianyu@ubuntu:~$ sudo docker pull k8s.gcr.io/kube-apiserver:v1.13.3
v1.13.3: Pulling from kube-apiserver
73e3e9d78c61: Pull complete
d261e2f8ca5b: Pull complete
Digest: sha256:cdb80dc78f3c25267229012a33800b8b203e8e8b9fa59f9fe93e156cc859f89c
Status: Downloaded newer image for k8s.gcr.io/kube-apiserver:v1.13.3
tianyu@ubuntu:~$ sudo docker pull k8s.gcr.io/kube-controller-manager:v1.13.3
v1.13.3: Pulling from kube-controller-manager
73e3e9d78c61: Already exists
846fc1deb4d7: Pull complete
Digest: sha256:408350880946f037be82d6ad2ed7dc3746b221932f0eeb375aef935d62392031
Status: Downloaded newer image for k8s.gcr.io/kube-controller-manager:v1.13.3

为什么我无法通过 minikube 拉取镜像?

感谢您的宝贵时间。

最佳答案

我也在中国。请使用参数启动minikube

--docker-env HTTP_PROXY=http://10.0.2.2:35033 --docker-env HTTPS_PROXY=http://10.0.2.2:35033

关于docker - 运行 `minikube start` ,无法拉取 k8s.gcr 镜像,但 `docker pull` 可以,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54803393/

59 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com