Dockerhub registry Image accessing from Helm Chart using deployment YAML file

8/18/2018

I am trying to implement the CI/CD pipeline for my microservice by using Jenkins, Kubernetes and Kubernetes Helm. Here I am using Helm chart for packaging of YAML files and deployment into Kubernetes cluster. I am now learning the implementation of Helm chart and deployment. When I am learning, I found the image name definition in deployment YAML file.

I have two questions:

  1. If we only defining the image name, then it will automatically pull from Docker Hub? Or do we need to define additionally anything in the deployment chart YAML file for pulling?
  2. How the Helm Tiller communicating with Docker Hub registry?
-- Jacob
kubernetes
kubernetes-helm

2 Answers

8/18/2018

Docker image names in Kubernetes manifests follow the same rules as everywhere else. If you have an image name like postgres:9.6 or myname/myimage:foo, those will be looked up on Docker Hub like normal. If you're using a third-party repository (Google GCR, Amazon ECR, quay.io, ...) you need to include the repository name in the image name. It's the exact same string you'd give to docker run or docker build -t.

Helm doesn't directly talk to the Docker registry. The Helm flow here is:

  1. The local Helm client sends the chart to the Helm Tiller.
  2. Tiller applies any templating in the chart, and sends it to the Kubernetes API.
  3. This creates a Deployment object with an embedded Pod spec.
  4. Kubernetes creates Pods from the Deployment, which have image name references.

So if your Helm chart names an image that doesn't exist, all of this flow will run normally, until it creates Pods that wind up in ImagePullBackOff state.

P.S.: if you're not already doing this, you should make the image tag (the part after the colon) configurable in your Helm chart, and declare your image name as something like myregistry.io/myname/myimage:{{ .Values.tag }}. Your CD system can then give each build a distinct tag and pass it into helm install. This makes it possible to roll back fairly seamlessly.

-- David Maze
Source: StackOverflow

10/23/2018

Run the command below. It will generate blank chart with values.yaml, add key value pare inside values.yaml and use them in your deployment.yaml file as variable.

helm create mychart
-- dehulia vinay
Source: StackOverflow