<p>I am currently implementing CI/CD pipeline using docker , Kubernetes and Jenkins for my micro services deployment. And I am testing the pipeline using the public repository that I created in Dockerhub.com. When I tried the deployment using Kubernetes Helm chart , I were able to add my all credentials in Value.yaml file -the default file getting for adding the all configuration when we creating a helm chart.</p>

<p><strong>Confusion</strong></p>

<p>Now I removed my helm chart , and I am only using deployment and service n plane YAML files. SO How I can add my Dockerhub credentials here ?</p>

<ol>
<li>Do I need to use environment variable ? Or Do I need to create any separate YAML file for credentials and need to give reference in Deployment.yaml file ? </li>
<li>If I am using imagePullSecrets way How I can create separate YAML file for credentials ?</li>
</ol>

<p>From Kubernetes point of view: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/" rel="nofollow noreferrer">Pull an Image from a Private Registry</a> you can create secrets and add necessary information into your yaml (Pod/Deployment)</p>

<p>Steps:</p>

<p><strong>1</strong>. Create a Secret by providing credentials on the command line:</p>

<pre><code>kubectl create secret docker-registry regcred --docker-server=&lt;your-registry-server&gt; --docker-username=&lt;your-name&gt; --docker-password=&lt;your-pword&gt; --docker-email=&lt;your-email&gt;
</code></pre>

<p><strong>2</strong>. Create a Pod that uses your Secret (example pod):</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: &lt;your-private-image&gt;
  imagePullSecrets:
  - name: regcred
</code></pre>
