<p>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.</p>

<p>I have two questions:</p>

<ol>
<li>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?</li>
<li>How the Helm Tiller communicating with Docker Hub registry?</li>
</ol>

<p>Docker image names in Kubernetes manifests follow the same rules as everywhere else.  If you have an image name like <code>postgres:9.6</code> or <code>myname/myimage:foo</code>, 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 <code>docker run</code> or <code>docker build -t</code>.</p>

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

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

<p>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 <code>ImagePullBackOff</code> state.</p>

<p>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 <code>myregistry.io/myname/myimage:{{ .Values.tag }}</code>.  Your CD system can then give each build a distinct tag and pass it into <code>helm install</code>.  This makes it possible to roll back fairly seamlessly.</p>
