[英]k8s: make local image accessible for k8s
I've just installed a k8s cluster (k3d).我刚刚安装了一个 k8s 集群(k3d)。
I'm just playing with that and I'm running against the first newbie issue: How to load our local created images.我只是在玩这个,我正在解决第一个新手问题:如何加载我们本地创建的图像。
I mean, I've just created a docker image tagged as quarkus/feedly:v1
.我的意思是,我刚刚创建了一个
quarkus/feedly:v1
镜像,标记为quarkus/feedly:v1
。
I've deployed my manifest and I'm getting these events:我已经部署了我的清单,并且收到了这些事件:
Failed to pull image "quarkus/feedly:0.0.1-SNAPSHOT": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/quarkus/feedly:0.0.1-SNAPSHOT": failed to resolve reference "docker.io/quarkus/feedly:0.0.1-SNAPSHOT": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
无法拉取图像“quarkus/feedly:0.0.1-SNAPSHOT”:rpc 错误:代码 = 未知描述 = 无法拉取和解压图像“docker.io/quarkus/feedly:0.0.1-SNAPSHOT”:无法解析参考“docker.io/quarkus/feedly:0.0.1-SNAPSHOT”:拉取访问被拒绝,存储库不存在或可能需要授权:服务器消息:不足范围:授权失败
I know it's a normal error since quarkus registry doesn't exist.我知道这是一个正常错误,因为 quarkus 注册表不存在。
Any helping code over there?那里有帮助代码吗?
Here are some pointers :这里有一些提示:
Hope this helps !希望这可以帮助 !
If you are using k3d, and this is just for playing around ( Not Production intended ) and for any reason don't want to use any of the many Container Registries that are out there such:如果您使用的是 k3d,并且这只是为了玩耍(不是用于生产),并且出于任何原因不想使用现有的许多容器注册表中的任何一个,例如:
You could add registries by specifying them in a registries.yaml
您可以通过在
registries.yaml
指定它们来添加registries.yaml
k3d cluster create mycluster --volume "/home/YOU/my-registries.yaml:/etc/rancher/k3s/registries.yaml"
and create your own registry locally using docker:并使用 docker 在本地创建您自己的注册表:
docker volume create local_registry
docker container run -d --name registry.localhost -v local_registry:/var/lib/registry --restart always -p 5000:5000 registry:2
👆Notice, what it does is to create the registry using this image: 👆注意,它的作用是使用此图像创建注册表:
From DockerHub 🤷♂️ which is one of the docker registries you avoided来自 DockerHub 🤷♂️,这是您避免使用的 Docker 注册表之一
Here you can find more information on how to set it up: https://k3d.io/usage/guides/registries/在这里您可以找到有关如何设置的更多信息: https : //k3d.io/usage/guides/registries/
And finally, please remember that when you get your images from a private registry, you have to tell K8s the authentication information for your private registry, so it can download the image.... otherwise it will give you this error:最后,请记住,当您从私有注册中心获取图像时,您必须告诉 K8s 您私有注册中心的身份验证信息,以便它可以下载图像....否则它会给您这个错误:
...pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
...拉取访问被拒绝,存储库不存在或可能需要授权:服务器消息:不足范围:授权失败
You can find more documentation on how to set this up here:您可以在此处找到有关如何设置的更多文档:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.