我已经阅读了很多关于此的帖子,但根据他们的说法,我应该有我的基础,所以我不确定发生了什么。
我在 Mac 上使用 Minikube、Docker、Helm 和本地 Docker 注册表。使用 Helm 安装后,我看到以下错误。
Failed to pull image "127.0.0.1:5000/hello-world:v1.0": rpc error: code = Unknown desc = Error response from daemon: manifest for 127.0.0.1:5000/hello-world:v1.0 not found: manifest unknown: manifest unknown
我的部署规范如下所示。
spec:
containers:
- name: hello-world
image: 127.0.0.1:5000/hello-world:v1.0
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 5000
protocol: TCP
如果我尝试拉取图像,我就会得到这个。
$docker pull 127.0.0.1:5000/hello-world:v1.0
v1.0: Pulling from hello-world
Digest: sha256:0534fcc8d406574f7def33e726f0e476ce94866e21d8cbd6ed4c273de113e9d3
Status: Image is up to date for 127.0.0.1:5000/hello-world:v1.0
127.0.0.1:5000/hello-world:v1.0
然后我检查清单,它存在。
$curl -X GET 127.0.0.1:5000/v2/hello-world/manifests/sha256:0534fcc8d406574f7def33e726f0e476ce94866e21d8cbd6ed4c273de113e9d3
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 8102,
"digest": "sha256:49188cd9fa7002b28391f01ba5c0ce4328cc467abeb6743d181cbe1a3a2fd37c"
},
...
}
任何帮助将不胜感激
编辑:
我执行的具体命令如下
编辑分辨率:
我终于让它发挥作用了。我必须按照 @zsolt 线程中的建议将 pod/部署清单的 podspec 中的图像键修改为
host.minikube.internal:5000/hello-world:v1.0
。其次,在此更改之前执行 --insecure-registry="host.minikube.internal:5000"
时,我必须使用 --insecure-registry="127.0.0.1:5000"
而不是 minikube delete
来启动 minikube。感谢您的帮助@zsolt!
您可以在 minikube 中启用注册表插件:
minikube addons enable registry
您还可以启用注册表别名:
minikube addons enable registry-aliases # test.com, test.org, example.com, example.org
文档:https://github.com/kubernetes/minikube/blob/master/deploy/addons/registry-aliases/README.md
更新:
我刚刚重读了您的问题,您想从 minikube 访问主机上运行的注册表。为此,您可以使用
host.minikube.internal
主机名,因此 host.minikube.internal:5000/hello-world:v1.0