Implementing Spinnaker with Kubernetes for Continuous Delivery

Introduction to Spinnaker and Kubernetes

Spinnaker is a continuous delivery platform that aims to deploy software changes in a multi-cloud environment such as AWS, GCP. Spinnaker takes out the manual activities by automating the processes in a Continuous Delivery approach, and it helps organizations to:

  • Manage their application deployments in a multi-cloud environment,
  • Provides a single pane of control and visibility via the dashboard.
  • Enforces enterprise policies.

What is Kubernetes?

Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services that facilitates both declarative configuration and automation.

What is Continuous delivery?

It releases changes such as features, bug fixes, configurations into end-users hands or production environments in a safe, quick, and autonomous process.


What are the Core Concepts of Spinnaker?

Spinnaker has two core concepts:

  1. Application Management
  2. Application Deployment

1. Application management

This allows us to manage and view the underlying cloud resources. Spinnaker uses the terms clusters, applications, and server groups to describe the services.

Applications

Applications are collections of clusters, whereas clusters are collections of server groups, also consist of load balancers and firewalls. It represents the services you’re going to deploy, all configurations for that service, as well as the infrastructure to deploy it.

Cluster

Groupings of service groups can be termed clusters.

Server Groups

Server groups help to identify various deployable components such as VM image, docker image. Also, some basic configurable settings such as autoscaling policies, instances count, etc. A server group is a collection of running service instances, e.g., pods, VM’s, etc.

Load Balancer

As the name suggests, it balances the traffic song instances belonging to its server group.

Firewall

A firewall controls network traffic access.


The primary purpose or goal of Spinnaker is to make reliable deployments with the simplest rollbacks.

Source: Spinnaker – Multi-Cloud Continuous Delivery Platform


2. Application Deployment

Application deployment features are beneficial to create continuous delivery workflows.

Pipeline

It manages deployment in Spinnaker. The pipeline comprises stages, and each step represents a sequence of actions. Can start pipeline either manually or automatically. We can relate this to a Jenkins job as well. In the end, we can also add notifications that will go to respective endpoints such as SMS or email with the result of pipeline execution.

Stage

A stage is a sequence of steps or actions that a pipeline will perform. Stages in a pipeline can be any sequence such as Deploy, Rebuild, Create stage.

Deployment Strategies

Spinnaker support all deployment strategies, such as Blue-green, Red/Black, Canary, etc.

Blue/Green

Blue-green deployment is a deployment strategy with two identical environments, a “blue” and a “green” environment with different versions of an application. Testing is performed on Blue environments such as Quality assurance, and once testing is done, the user traffic is shifted to the Green environment from the Blue environment.

Canary Deployment

Canary deployment is a deployment strategy that releases an application incrementally to a subset of users. All infrastructure in a target environment is updated in small phases (e.g: 2%, 30%, 78%, 100%).


Read more about GitOps Tools, Pipelines, and Kubernetes Operator


Use Cases

  • There could be several use cases, out of which simplest being detecting a container image push. Some tests will be performed on the image that, on being successful, will make the Spinnaker push the image to the repository.
  • We can even introduce a manual approval before the deployment stage if we want to notify a group of devs to approve the deployment.
  • There can be other stages like slacking a dev team that there is an approval waiting, kicking off another pipeline run in a stage, or sending off a webhook, to name a few.

How does Spinnaker work with Kubernetes?

  • Monitor kubernetes Cluster health using Spinnaker.
  • Spinnaker constructs such as server groups or load balancers can be mapped to spinnaker resources.
  • Capabilities offered by Spinnaker are more advanced than Kubernetes deployment API.
  • Spinnaker offers multiple deployment strategies with the help of deployment pipelines which Kubernetes do not offer.

Kubernetes Deployments vs. Spinnaker Deployment

  • Spinnaker uses Kubernetes API, so it helps to perform every function that kubernetes offers. (using kubectl)
  • Spinnaker offers various deployment strategies such as Blue/Green and easy rollbacks. Kubernetes does not offer that.
  • Kubernetes uses a Deployment controller to deploy resources, now suggested is to use a ReplicaSet.

What are the Features of Spinnaker?

  • It can be pointed to an existing Kubernetes cluster.
  • Spinnaker offers the capability of reading the existing deployment of resources in a Kubernetes cluster as if they were deployed by Spinnaker and showed the same in its dashboard.
  • Spinnaker adds no additional metadata to any Cloud provider such as AWS, GCP.
  • It offers to deploy things using Spinnaker UI, but Spinnaker SPI can directly help to control things.

What Customer Base is using Spinnaker?

  • Organizations that have High scalability as a requirement.
  • Organizations who want to run Spinnaker on their premises.
  • Customers are running and monitoring hundreds of VM’s using Spinnaker.

Click to explore Step-by-Step Guide to Set up Jenkins on Kubernetes


What is the Kubernetes Deployment Workflow with Spinnaker?

Simple Kubernetes deployment workflow with Spinnaker

Pre-requisites

  • Running Kubernetes Cluster.
  • A Spinnaker set-up with Jenkins CI enabled.
  • Github webhook enabled for Jenkins jobs.

Strategy Overview

Github + Jenkins: CI System to build the docker image and push to the registry.

Docker hub: Registry to store docker images.

Spinnaker: CD System to enable automatic deployments to various environments.

Workflow

  1. On having the master branch of a Git repo being merged, a Jenkins job is triggered via Github webhook.
  2. The Jenkins job checks out the repo, build code, and pushes the docker image to the Docker hub.
  3. Then a Spinnaker pipeline is triggered by the job, which also sends a trigger.properties file as a build artifact. This properties file contains essential info that is beneficial for Spinnaker further.

Properties File

TAG=1.8-V2

ACTION=DEPLOY


Conclusion

We discussed how to create a continuous delivery pipeline with Spinnaker. We also shared various Spinnaker concepts such as Spinnaker pipelines, stages. While this pipeline is fundamental, Spinnaker supports much more things, such as rollbacks and different deployment strategies such as canary deployments Blue/Green. Integrate it with Continous Integration tools like Jenkins and Travis CI. It can also integrate with Prometheus and SignalFx for canary analysis.


Leave a Comment

Name required.
Enter a Valid Email Address.
Comment required.(Min 30 Char)