<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CICD using Jenkins and Spinnaker]]></title><description><![CDATA[CICD using Jenkins and Spinnaker]]></description><link>https://spinnaker-jenkins.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 05:32:25 GMT</lastBuildDate><atom:link href="https://spinnaker-jenkins.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[CI/CD Using Jenkins and Spinnaker: Automating Deployment to Kubernetes]]></title><description><![CDATA[Introduction:
In modern software development, Continuous Integration and Continuous Deployment (CI/CD) pipelines play a crucial role in ensuring efficient and automated workflows. This blog focuses on setting up a CI/CD pipeline using Jenkins and Spi...]]></description><link>https://spinnaker-jenkins.hashnode.dev/cicd-using-jenkins-and-spinnaker-automating-deployment-to-kubernetes</link><guid isPermaLink="true">https://spinnaker-jenkins.hashnode.dev/cicd-using-jenkins-and-spinnaker-automating-deployment-to-kubernetes</guid><category><![CDATA[Spinnaker]]></category><category><![CDATA[Devops]]></category><category><![CDATA[ci-cd]]></category><category><![CDATA[ Jenkins, DevOps]]></category><category><![CDATA[Kubernetes]]></category><dc:creator><![CDATA[Sharath Veerapaneni]]></dc:creator><pubDate>Wed, 22 Jan 2025 08:31:59 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction:</h2>
<p>In modern software development, Continuous Integration and Continuous Deployment (CI/CD) pipelines play a crucial role in ensuring efficient and automated workflows. This blog focuses on setting up a CI/CD pipeline using Jenkins and Spinnaker for a Git-based application. When changes are pushed to the Git repository, Jenkins triggers the build process, builds the Docker image, pushes it to a Docker registry, and deploys the application to a Kubernetes cluster.</p>
<p>Let’s dive into the details of setting up this robust CI/CD pipeline.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737534311778/83732b4a-044c-408b-8725-0d59e9118937.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-table-of-contents">Table Of Contents:</h2>
<ul>
<li><p><strong>Overview</strong></p>
</li>
<li><p><strong>Prerequisites</strong></p>
</li>
<li><p><strong>Setting Up Jenkins</strong></p>
</li>
<li><p><strong>Setting Up Spinnaker</strong></p>
</li>
<li><p><strong>Integrating Jenkins with Spinnaker</strong></p>
</li>
<li><p><strong>Installation</strong></p>
</li>
<li><p><strong>Conclusion</strong></p>
</li>
</ul>
<h3 id="heading-1-overview">1. Overview</h3>
<p>In this setup, the CI/CD process involves:</p>
<ul>
<li><p><strong>Source Code Repository</strong>: GitHub/GitLab repository where developers push changes.</p>
</li>
<li><p><strong>Jenkins</strong>: Automates the build and push image to docker and update the image tag in git repo</p>
</li>
<li><p><strong>Docker</strong>: Builds Docker images for the application.</p>
</li>
<li><p><strong>Docker Registry</strong>: Stores Docker images.</p>
</li>
<li><p><strong>Spinnaker</strong>: Orchestrates deployments to Kubernetes.</p>
</li>
</ul>
<p>Each commit to the Git repository triggers Jenkins, which builds the Docker image and pushes it to a Docker registry. Spinnaker then deploys the image to a Kubernetes cluster.</p>
<h2 id="heading-2-prerequisites">2. Prerequisites</h2>
<p>Before starting with the setup, ensure the following prerequisites are in place:</p>
<ul>
<li><p><strong>Version Control System</strong>: GitHub or GitLab</p>
</li>
<li><p><strong>Jenkins</strong>: Installed and configured for CI/CD automation</p>
</li>
<li><p><strong>Spinnaker</strong>: Installed and configured for deployment orchestration</p>
</li>
<li><p><strong>Docker</strong>: Installed for building Docker images</p>
</li>
<li><p><strong>Kubernetes</strong>: Cluster setup for deploying applications</p>
</li>
<li><p><strong>Docker Registry</strong>: Docker Hub, AWS ECR, or any private registry</p>
</li>
</ul>
<h2 id="heading-3-setting-up-jenkins">3. Setting Up Jenkins</h2>
<ol>
<li><p><strong>Installation and Configuration</strong>:</p>
<ul>
<li><p>Install Jenkins on your server.</p>
</li>
<li><p>Configure Jenkins with necessary plugins for Docker, Kubernetes, and Git.</p>
</li>
<li><p>Create necessary credentials for Docker registry and Kubernetes cluster.</p>
</li>
</ul>
</li>
<li><p><strong>Jenkins Credentials</strong>:</p>
<ul>
<li><p>Docker registry credentials (username and password/token).</p>
</li>
<li><p>Kubernetes credentials for accessing the cluster.</p>
</li>
</ul>
</li>
</ol>
<h2 id="heading-4-setting-up-spinnaker">4. Setting Up Spinnaker</h2>
<ol>
<li><p><strong>Installation and Configuration</strong>:</p>
<ul>
<li><p>Install Spinnaker with necessary integrations (Docker registry, Kubernetes, etc.).</p>
</li>
<li><p>Configure Spinnaker pipelines for deployments and manage resources.</p>
</li>
</ul>
</li>
<li><p><strong>Pipeline Configuration</strong>:</p>
<ul>
<li>Define stages for Configuration, Bake, and Deploy stages in Spinnaker.</li>
</ul>
</li>
</ol>
<h2 id="heading-5-integrating-jenkins-with-spinnaker">5. Integrating Jenkins with Spinnaker</h2>
<ul>
<li><p><strong>Webhook Integration</strong>:</p>
<ul>
<li><p>Configure Spinnaker to listen for webhooks from Jenkins.</p>
</li>
<li><p>When a build completes successfully in Jenkins, a webhook is sent to Spinnaker to trigger deployment.</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-6installation">6.Installation:</h2>
<p><strong>Step: 1</strong></p>
<p>Deploy the spinnaker on k8s cluster using helm, by using the below chart<br /><a target="_blank" href="https://artifacthub.io/packages/helm/opsmx/spinnaker">spinnaker 2.2.7 · opsmx/opsmx</a></p>
<p><strong>Step:2</strong></p>
<p>Login to the halyard container and configure Git ,Jenkins , and Kubernetes</p>
<pre><code class="lang-bash">kubectl <span class="hljs-built_in">exec</span> -it spinnaker-spinnaker-halyard-0 -n spinnaker -- bash
Defaulted container <span class="hljs-string">"halyard"</span> out of: halyard, create-halyard-local (init)
bash-5.0$
</code></pre>
<p><strong>Step: 3</strong></p>
<p>Enable and configure Kubernetes using Hal commands</p>
<pre><code class="lang-bash">  hal config provider kubernetes <span class="hljs-built_in">enable</span>

  hal config provider kubernetes account add k8s-account --provider-version v2 --context $(kubectl config current-context)
  note: k8s-account &lt;account name we can add any this name will be reflected <span class="hljs-keyword">in</span> spinnaker or we can get the nam default as well&gt;
</code></pre>
<p><strong>Step:4</strong></p>
<p>Enable and configure git repo and git hub for artifacts.</p>
<pre><code class="lang-bash">  hal config artifact github <span class="hljs-built_in">enable</span>
  hal config artifact github account add &lt;ACCOUNT_NAME&gt;  --token &lt;GITHUB_TOKEN&gt;

<span class="hljs-comment">## We need to enable artifacts from git repo so we need to configure gitrepo</span>

hal config artifact gitrepo <span class="hljs-built_in">enable</span>
<span class="hljs-comment">## Fetch the tooken from github and store it in the file like below.</span>
<span class="hljs-built_in">echo</span> <span class="hljs-variable">$TOKEN</span> &gt; <span class="hljs-variable">$TOKEN_FILE</span>

<span class="hljs-comment">## add account using like this </span>
hal config artifact gitrepo account add <span class="hljs-variable">$ARTIFACT_ACCOUNT_NAME</span> \
    --token-file <span class="hljs-variable">$TOKEN_FILE</span>
</code></pre>
<p><strong>Step: 5</strong></p>
<p>Enable and configure Jenkins</p>
<pre><code class="lang-bash">hal config ci jenkins <span class="hljs-built_in">enable</span>
hal config ci jenkins master add jenkins-master --address &lt;jenkins url&gt; --username &lt;username&gt; --password &lt;password&gt;
hal config ci jenkins master edit jenkins-master --csrf <span class="hljs-literal">true</span>
</code></pre>
<p><strong>Step: 6</strong></p>
<p>After doing all this run below command to apply the changes:</p>
<pre><code class="lang-bash">hal deploy apply
</code></pre>
<p><strong>Step:7</strong></p>
<p>Follow the below repo for the source code and fork it to your git repo and enable github webhook with Jenkins. with push events</p>
<p><a target="_blank" href="https://github.com/invisiblelad/helm">GitHub repo</a></p>
<p><strong>Step:8</strong><br />Configure the Jenkins pipeline using the GitHub repo and add all the needed credentials like the docker hub registry, git credentials on the credentials section of Jenkins like below</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737530529804/a349f352-f8a9-49f0-b32d-f3d33a3ed981.png" alt class="image--center mx-auto" /></p>
<p><strong>Step:9:</strong></p>
<p>Now go to Spinnaker and create a application and create a pipeline like below</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737530609323/5227dc76-d292-48c3-9b3a-d4e034b64340.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-pipeline-stages"><strong>Pipeline Stages:</strong></h3>
<p><strong>Configuration:</strong></p>
<ul>
<li><p>Go to automatic triggers and add Jenkins as type and add the account which you configured before and add the job. like below.</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737530734195/bb38b300-5396-4800-94e1-529161f97605.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p><strong>Bake:</strong></p>
<p>Click on add stage and add a new stage as Bake Manifest</p>
<p>Here add the render engine as Helm and add git repo which we configured before ad the chart name. This stage will fetch the chart from repo and will make it as a artifact</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737530849651/30261c8b-bb2b-4f84-80f1-b6fa4060795f.png" alt class="image--center mx-auto" /></p>
<p><strong>Deploy:</strong></p>
<p>Click on add stage and add a stage as Deploy manifest it will fetch the artifact produced from previous stage and deploy it on k8s cluster which we configured before. Here i deployed spinnaker on k8s so it the account name is default if it is an external account then we need to give another name while configuring before.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737531022224/59c2be6c-d912-45fb-9a93-3ac8365ae498.png" alt class="image--center mx-auto" /></p>
<p><strong>Step: 8:</strong></p>
<p>Now trigger the pipeline either manually or automatically as we have enabled the trigger with Jenkins, so whenever a job gets triggered on Jenkins a spinnaker pipeline will be triggered with that build number.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1737531206541/d5ce3e78-723c-4737-a44b-ba2db067b2b4.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-6conclusion">6.Conclusion:</h3>
<p>By integrating Jenkins and Spinnaker into your CI/CD pipeline, you create a powerful, automated workflow that ensures smooth application delivery to Kubernetes. This streamlined process automates code changes from version control through build and testing phases to the deployment of Docker images in a reliable and efficient way.</p>
<p>With Jenkins handling the build and image creation and Spinnaker managing deployments across Kubernetes, teams can focus on developing features while maintaining a strong and repeatable deployment process. The ability to monitor, roll back, and scale deployments ensures a highly resilient environment for your applications, ultimately driving faster innovation and improved development speed.</p>
]]></content:encoded></item></channel></rss>