问题描述
我有一个带有一堆映像的私有Docker存储库.我正在使用Helm将它们部署到Kubernetes集群中.
I have a private Docker repo with bunch of images. I am using Helm to deploy them to a Kubernetes cluster.
Helm values.yaml包含存储库凭据:
Helm values.yaml contains the repository credentials:
image:
repository: <repo>
tag: <version tag>
pullPolicy: IfNotPresent
imageCredentials:
registry: <repo>
username: <username>
password: <pw>
完成头盔安装后
窗格的状态为Init:ErrImagePull.kubectl describe pods出现此错误:
the pod's status is Init:ErrImagePull.kubectl describe pods gives this error:
推荐答案
这取决于舵图的输出.您可以使用helm template
来查看生成的kubernetes资源,而无需实际部署它.使用来自私有Docker注册表的图像可分为两个步骤:
It depends on the output of your helm chart. You can use helm template
to see the resulting kubernetes resources without actually deploying it. Using an image from a private docker registry comes down to two steps:
-
确保您具有
secret
资源(用于私有存储库).请注意,这里的类型是kubernetes.io/dockerconfigjson
或kubernetes.io/dockercfg
.
在此处.
Pod资源/模板:
spec:
containers:
- name: some-pod
image: <image>
imagePullSecrets:
- name: <name-of your secret>
您可以先手动构建资源,而无需掌舵.这有助于验证资源本身是否正确.然后,您可以调整头盔模板以根据给定的值输出正确的资源.
You can first build the resources by hand without helm. This helps to verify that the resources themselves are correct. Then you can adapt the helm templates to output the correct resources given your values.
这篇关于舵图部署和私有Docker存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!