我正在使用Helm-kubernetes和azure kubernetes服务进行一个项目,其中我正在尝试使用一个简单的节点映像,我已经在我的helm图表中的azure容器注册表上推送了该映像,但它返回ImagePullBackOff
错误。
以下是一些详细信息:
我的Dockerfile
:
FROM node:8
# Create app directory
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
# Bundle app source
COPY . .
EXPOSE 32000
CMD [ "npm", "start" ]
我的helm_chart/values.yaml
:
replicaCount: 1
image:
registry: helmcr.azurecr.io
repository: helloworldtest
tag: 0.7
pullPolicy: IfNotPresent
nameOverride: ""
fullnameOverride: ""
service:
name: http
type: LoadBalancer
port: 32000
internalPort: 32000
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
paths: []
hosts:
- name: mychart.local
path: /
tls: []
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}
当我尝试直接拉取图像时,以下命令如下: docker pull helmcr.azurecr.io/helloworldtest:0.7
然后它成功拉取映像。
这里可能出了什么问题?
提前感谢!
您的 kubernetes 集群需要向容器注册表进行身份验证才能拉取映像,通常这是由 docker 机密完成的:
kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
如果使用 AKS,则可以向注册表授予群集应用程序 ID 拉取权限,这就足够了。
阅读: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/