使用私有注册表中的自定义镜像
从 Neo4j 4.4.4 开始,您可以通过添加新的或现有 imagePullSecrets
来使用私有注册表中的自定义镜像。
添加现有 imagePullSecret
您可以通过在 values.yaml 文件中指定其名称来为您的 Neo4j 部署使用现有的 imagePullSecret
。Neo4j Helm chart 会检查所提供的 imagePullSecret
是否存在于 Kubernetes 集群中并使用它。如果集群中不存在具有给定名称的 Secret,Neo4j Helm chart 将抛出错误。
有关如何在集群中将 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
或者,您可以通过在 values.yaml 文件中定义等效的 imageCredential
来为您的 Neo4j 部署创建新的 imagePullSecret
。
Neo4j Helm chart 会创建一个具有给定名称的 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: "your_password"
email: "myusername@example.com"
name: "mysecret"