Pull docker hub images in Helm chart values.yaml

1/21/2019

I'm new to helm and Kubernetes world. I'm working on a project using Docker, Kubernetes and helm in which I'm trying to deploy a simple Nodejs application using helm chart on Kubernetes.

Here's what I have tried:

From Dockerfile:

FROM node:6.9.2
EXPOSE 30000
COPY server.js .
CMD node server.js

I have build the image, tag it and push it to the docker hub repository at: MY_USERNAME/myhello:0.2

Then I run the simple commad to create a helm chart as: helm create mychart It created a mychart directory witll all the helm components.

Then i have edited the values.yaml file as:

replicaCount: 1
image:
  repository: MY_USERNAME/myhello
  tag: 0.2
  pullPolicy: IfNotPresent

nameOverride: ""
fullnameOverride: ""

service:
  type: NodePort
  port: 80
  externalPort: 30000

ingress:
  enabled: false
  annotations: {}
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
  paths: []
  hosts:
    - chart-example.local
  tls: []
  #  - secretName: chart-example-tls
  #    hosts:
  #      - chart-example.local

resources: {}
  # We usually recommend not to specify default resources and to leave this as a conscious
  # choice for the user. This also increases chances charts run on environments with little
  # resources, such as Minikube. If you do want to specify resources, uncomment the following
  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
  # limits:
  #  cpu: 100m
  #  memory: 128Mi
  # requests:
  #  cpu: 100m
  #  memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

After that I have installed the chart as: helm install --name myhelmdep01 mychart

and when run kubectl get pods it shows the ErrImagePull

I have tried with by mentioning the image name as : docker.io/arycloud/myhello in this case the image pulled successfully but there's another error comes up as:

Liveness probe failed: Get http://172.17.0.5:80/: dial tcp 172.17.0.5:80: connect: connection refused

-- Abdul Rehman
docker
dockerhub
kubernetes
kubernetes-helm

1 Answer

1/21/2019

Run kubectl describe pod <yourpod> soon after the error occurs and there should be an event near the bottom of the output that tells you exactly what the image pull problem is.

Off the top of my head it could be one of these options:

  • It's a private repo and you haven't provided the service account for the pod/deployment with the proper imagePullSecret
  • Your backend isn't docker or does not assume that non prefixed images are on hub.docker.com. Try this instead: registry-1.docker.io/arycloud/myhello

If you can find that error it should be pretty straight forward.

-- Brett Wagner
Source: StackOverflow