拉动图像时更改Kubernetes的平台

发布于 2025-01-25 23:47:23 字数 488 浏览 1 评论 0原文

我正在使用Apple M1,编写kubernetes yaml文件来拉动和部署图像confluentinc/cp-zookeeper:6.2.4问题是,由于CPU架构的差异,我无法拉出图像

Failed to pull image "confluentinc/cp-zookeeper:6.2.4": rpc error: code = Unknown desc = no matching manifest for linux/arm64/v8 in the manifest list entries

使用Docker-Compose时,我只能指定标签平台:linux/x86_64,并且一切都如正常一样,但是我不确定如何为K8S执行此操作,我尝试设置环境变量docker_default_platform,但也无法正常工作。

我正在使用docker-desktop内置的kubernetes

I am using an Apple M1, writing a Kubernetes YAML file to pull and deploy the image confluentinc/cp-zookeeper:6.2.4 the problem is, I cannot pull the image due to the difference in CPU architecture

Failed to pull image "confluentinc/cp-zookeeper:6.2.4": rpc error: code = Unknown desc = no matching manifest for linux/arm64/v8 in the manifest list entries

When using docker-compose, I can just specify the tag platform: linux/x86_64 and everything goes as normal, but I'm not sure how to do this for K8S, I have tried to set the environment variable DOCKER_DEFAULT_PLATFORM as well but it's not working either.

I'm using Docker-Desktop's built in Kubernetes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡淡離愁欲言轉身 2025-02-01 23:47:23

据我所知,POD/部署没有选择来定义架构。
我认为,如果指向容器图像上下文,Kubernetes将自动提取正确的图像。当您只有没有索引的单个图像时,就必须与NodeSelectors或其他内容一起工作,然后将CPU架构固定在图像标签上( https://kubernetes.io/docs/concepts/concepts/containers/containers/images/#multi-achitection-unmages/#multi-architecture-images-with-images-with-image-image-image-image-image-indexes < /a>)。

在您的问题中给定的图像:
我认为,在这种情况下,Confluentinc/cp-zookeeper在Docker Hub中具有ARM64图像,但没有ARM64/V8图像。
现在,我不知道M1上Docker的内部。但是我有点惊讶X86_64甚至在ARM CPU上工作。

As I know there is no option for Pods/Deployments to define an architecture.
I assume, that Kubernetes will automatically pull the correct image if you point to a Container image context. When you have only single images without an index then you have to work with nodeSelectors or something else and to pin the CPU architecture over the image tag (https://kubernetes.io/docs/concepts/containers/images/#multi-architecture-images-with-image-indexes).

To your given image in your question:
In this case, I think, is the issue that confluentinc/cp-zookeeper has a ARM64 image in Docker Hub but no ARM64/v8 image.
Now I don't know the internals of Docker on M1. But I am a bit surprised that x86_64 even work on an ARM CPU.

三岁铭 2025-02-01 23:47:23

只是只能使用图像摘要,例如&lt; image-name&gt;@@&lt; imp;

  db:
    image: mysql@sha256:358b0482ced8103a8691c781e1cb6cd6b5a0b463a6dc0924a7ef357513ecc7a3
    container_name: mysql

要确保POD始终使用相同版本的容器图像,您可以指定图像的摘要;替换:与 @(例如,图像 @ sha256:45b23dee08af5e43a7fea6c4cf9c25cc25ccf269ee113168c1972222f878766677c5c5cb2)。

just can only use image digest, like <image-name>@<digest>

  db:
    image: mysql@sha256:358b0482ced8103a8691c781e1cb6cd6b5a0b463a6dc0924a7ef357513ecc7a3
    container_name: mysql

https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy

To make sure the Pod always uses the same version of a container image, you can specify the image's digest; replace : with @ (for example, image@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文