XenonStack Recommends

Deployment Automation

Implementing Spinnaker with Kubernetes for Continuous Delivery

Gursimran Singh | 02 Nov 2023

Spinnaker with Kubernetes for Continuous Delivery of Software

Spinnaker and Kubernetes - Accelerating Continuous Delivery

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:
  1. Manage their application deployments in a multi-cloud environment,
  2. Provides a single pane of control and visibility via the dashboard.
  3. Enforces enterprise policies.

What is Kubernetes?

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

What is Continuous Delivery?

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

Amazon EKS (Elastic Kubernetes Service) is a managed service that makes it easier to run Kubernetes on AWS. With Amazon EKS, you can deploy, manage, and scale containerized applications using Kubernetes without the need to manage the underlying infrastructure.

The Fundamental Concept of Spinnaker

Spinnaker has two core concepts: Application Management and Application Deployment. These concepts are the foundation of Spinnaker's ability to streamline continuous delivery workflows and ensure consistent and reliable deployments in a multi-cloud environment.

  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 consisting of load balancers and firewalls. It represents the services you will deploy, all configurations for that service, and the infrastructure to deploy it.

Cluster

Groupings of service groups can be termed clusters.

Server Groups

Server groups help identify various deployable components such as VM and docker. Also, some basic configurable settings include autoscaling policies, instance count, etc. A server group is a collection of running service instances, e.g., pods, VMs, 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.

2. Application Deployment

Application deployment features are beneficial to creating 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. Ultimately, 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 a pipeline performs. Stages in a pipeline can be any sequence such as the deployment, rebuild, and creation stages.

Deployment Strategies

Spinnaker supports all deployment strategies, such as Blue-green, Red/Black, Canary, etc. Blue/Green Blue-green deployment is a 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 from the Blue environment to the Green 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%).

Kubernetes Operators and the Operator Framework provide a powerful way to automate application management tasks on Kubernetes and streamline continuous delivery workflows and ensure consistent & reliable deployments in a multi-cloud environment.

Spinnaker Use Cases

  1. There could be several use cases, the 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.
  2. We can even introduce manual approval before the deployment stage if we want to notify a group of developers to approve the deployment.
  3. There can be other stages like slacking a dev team with 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?

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

Kubernetes vs Spinnaker Deployment

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

What are the Features of Spinnaker?

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

What Customer Base is using Spinnaker?

  1. Organizations that have High scalability as a requirement.
  2. Organizations who want to run Spinnaker on their premises.
  3. Customers are running and monitoring hundreds of VMs using Spinnaker.

Streamline the application deployment workflows and ensure consistent and reliable deployments on Kubernetes clusters. Helm - Package Manager for Kubernetes

What is the Kubernetes Deployment Workflow with Spinnaker?

Simple Kubernetes deployment workflow with Spinnaker

Pre-requisites

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

Strategy Overview

Github + Jenkins: CI System to build the docker image and push it 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 the repo build code and pushes the docker image to the Docker hub.
  3. Then, the job triggers a Spinnaker pipeline, which also sends a trigger.properties file as a build artifact. This properties file contains essential info that is beneficial for Spinnaker.
tools-for-kubernetes
A Kubernetes solution refers to integrating Spinnaker with Kubernetes to leverage its capabilities in managing and deploying applications.

Building Continuous Delivery Pipeline with Spinnaker

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