【问题标题】:I'm installing a custom WordPress image from Bitnami with Helm. Can't pull image from private repository in Docker Hub我正在使用 Helm 从 Bitnami 安装自定义 WordPress 图像。无法从 Docker Hub 中的私有存储库中提取图像
【发布时间】:2021-03-08 19:22:56
【问题描述】:

我正在尝试在 Minikube 上部署一个带有自定义插件和主题的 WordPress 实例。

首先,我创建了一个基于 Bitnami's Image 的自定义 WordPress Docker 映像。我已将其推送到 Docker Hub 并将存储库设为私有。

现在,我正在尝试使用 Bitnami 的 WordPress Helm Chart 部署映像。为此,我:

  1. 在与部署相同的命名空间中创建了一个秘密regcred,如Kubernetes Docs 中所述。

    kubectl create secret docker-registry recred --docker-server=https://index.docker.io/v1 --docker-username=USERNAME --docker-password=PWORD --docker-email=EMAIL

  2. 将图表的values-production.yaml (here) 更改为以下内容:

.

## Global Docker image parameters
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
##
global:
  imageRegistry: docker.io
  imagePullSecrets:
    - regcred
#   storageClass: myStorageClass

## Bitnami WordPress image version
## ref: https://hub.docker.com/r/bitnami/wordpress/tags/
##
image:
  registry: docker.io
  repository: MYUSERNAME/PRIVATEIMAGE
  tag: latest
  ## Specify a imagePullPolicy
  ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
  ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
  ##
  pullPolicy: IfNotPresent
  ## Optionally specify an array of imagePullSecrets.
  ## Secrets must be manually created in the namespace.
  ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
  ##
  pullSecrets:
    - regcred
  ## Set to true if you would like to see extra information on logs
  ##
  debug: true
...

我认为 pod 应该能够提取私有存储库,但它永远不能。状态卡在Waiting: ImagePullBackOff

我做错了吗?我正在关注this tutorial,顺便说一句。另外,我正在通过 WSL2(Ubuntu 发行版)在我的 Windows 10 上运行。

【问题讨论】:

  • 您在创建映像后是否在 DockerHub 上发布了它。 Yop 必须在 DockerHub 拥有或创建一个帐户,并使用login 命令从终端登录:sudo docker login。成功登录后,您是否使用标记中的 DockerHub 用户名重建了 docker 映像并将其推送到 DockerHub ?你读过docs.bitnami.com/kubernetes/get-started-kubernetes 吗?
  • 是的@Malgorzata,你说的我都做了。我想我已经解决了这个问题,正如我写的答案中所解释的那样。还是谢谢你!

标签: kubernetes bitnami dockerhub


【解决方案1】:

你好贡萨洛·菲格雷多,

重现此问题,当我使用 kubectl create secret docker-registry 并将图表部署在我的 linux vm 中的 GKE 集群中时,它工作得很好。

当我尝试在本地机器上使用 Minikube 时,我确实遇到了 ImagePullBackOff 错误。问题是我最近更改了我的 dockerHub 密码,并且我的主机中的凭据已过时。做一个新的docker login 解决了这个问题。

不确定您是否会发生类似的事情。如果没有,您能否检查您的私人仓库是否已启动并尝试使用另一种方法来创建包含 Docker 凭据的 Secret?

【讨论】:

  • 感谢您的意见@Francisco。我想我已经解决了这个问题,正如我写的答案中所解释的那样。问题不在于 Docker Hub 凭据。
【解决方案2】:

找到了解决方案。我只需要将秘密中的服务器属性从https://index.docker.io/v1 更改为docker.io

我现在面临另一个问题,但我认为这个问题已解决。

【讨论】:

    猜你喜欢
    • 2020-07-05
    • 2021-01-05
    • 1970-01-01
    • 2021-12-10
    • 2020-08-25
    • 2017-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多