从私有注册表使用自定义镜像

从 Neo4j 4.4.4 开始,您可以通过添加新的或现有的 imagePullSecrets 从私有注册表使用自定义镜像。

添加现有的 imagePullSecret

您可以通过在 values.yaml 文件中指定其名称来为您的 Neo4j 部署使用现有的 imagePullSecret。Neo4j Helm 图表会检查 Kubernetes 集群中是否存在提供的 imagePullSecret 并使用它。如果集群中不存在具有给定名称的 Secret,则 Neo4j Helm 图表将抛出错误。

有关如何在集群中将 Docker 凭据设置为 Secret 的更多信息,请参阅 Kubernetes 文档

使用已存在的 Secret mysecret
# values.yaml
# Override image settings in Neo4j pod
image:
  imagePullPolicy: IfNotPresent
  # set a customImage if you want to use your own docker image
  customImage: demo_neo4j_image:v1

  #imagePullSecrets list
  imagePullSecrets:
      - "mysecret"

创建并添加新的 imagePullSecret

或者,您可以为您的 Neo4j 部署创建一个新的 imagePullSecret,方法是在 values.yaml 文件中定义一个等效的 imageCredential

Neo4j Helm 图表使用给定的名称创建一个 Secret,并将其用作 imagePullSecret 来拉取定义的自定义镜像。以下示例显示了如何定义一个名为 mysecret 的私有 Docker 仓库 imageCredential

创建并添加 mysecret 作为集群的 imagePullSecret
# values.yaml
# Override image settings in Neo4j pod
image:
  imagePullPolicy: IfNotPresent
  # set a customImage if you want to use your own docker image
  customImage: custom_neo4j_image:v1

  #imagePullSecrets list
  imagePullSecrets:
      - "mysecret"

  #imageCredentials list for which Secret of type docker-registry will be created automatically using the details provided
  # password and name are compulsory fields for an imageCredential, without these fields helm chart will throw an error
  # registry, username, and email are optional fields, but either the username or the email must be provided
  # imageCredential name should be part of the imagePullSecrets list or else the respective imageCredential will be ignored and no Secret creation will be done
  # In case of a Secret already pre-existing you don't need to mention the imageCredential, just add the pre-existing secretName to the imagePullSecret list
  # and that will be used as an imagePullSecret
  imageCredentials:
    - registry: "https://index.docker.io/v1/"
      username: "myusername"
      password: "mypassword"
      email: "myusername@example.com"
      name: "mysecret"