Modal Title
CI/CD / Kubernetes

Get Started with Spinnaker on Kubernetes

Jan 5th, 2018 6:01am by
Featued image for: Get Started with Spinnaker on Kubernetes
Feature image via Pixabay.

In the previous installment of the series, we introduced Spinnaker as the multicloud deployment tool. We will explore how to setup Spinnaker on the Kubernetes open source container orchestration engine and deploy your first application through it.

In this tutorial, I will walk you through how to setup and configure Spinnaker on Minikube. Once it is up and running, we will deploy and scale a containerized application running in Kubernetes.

Spinnaker is usually installed in a VM running Ubuntu 14.04 LTS. Thanks to the Helm community, it is now available as a Chart to install with just one command.

Install and Configure Minikube

Spinnaker is architected as a cloud-native, microservices application. It comes with a set of containers that are resource intensive. Typical Minikube installation doesn’t provide enough power for Spinnaker to run locally. We will customize Minikube configuration to make it powerful enough to host Spinnaker.

Alternatively, you can install Spinnaker on a Kubernetes cluster where the Nodes have at least 4GB RAM. Google Kubernetes Engine or Azure Container Service for Managed Kubernetes are ideal candidates for this configuration. Since Minikube is free and simple, we are using that to configure Spinnaker. This configuration is not recommended for production use.

Run the following commands to install Minikube on macOS.


We also need the latest version of Kubectl to manage the Kubernetes cluster. The following steps will install it.


With the prerequisites in place, let’s start Minikube.

Firstly, we need to make sure that Minikube VM is configured with at least 4GB RAM and 4 CPU cores. We do this with the below commands.


If you don’t want to persistent the configuration, you can also launch Minikube with the following parameters:



Wait for the single node Kubernetes cluster to start, and the verify the installation. If this is the first time you are launching Minikube, it will download the ISO file before starting the cluster.

Install Helm

Helm makes installing applications in Kubernetes extremely easy. Each application is packaged as a Chart, a deployable unit of Helm. Before installing Spinnaker Chart, we need to set up Helm on Kubernetes.

Download the latest release of Helm binary and move it to the bin folder




We will now install Helm and verify it.


Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.
Happy Helming!


The above output confirms that Helm and Tiller, the server-side component of Helm are properly installed. Tiller runs as a Kubernetes Pod and Service within the kube-system namespace.

Installing Spinnaker

With Minikube and Helm up and running, it’s time for us to install Spinnaker. Since it is available as a Helm Chart, we will get this done through a couple of steps.

Before we deploy Spinnaker, we need a configuration file in YAML format, which will provide the initial set of configuration values. Grab this file from the Github Spinnaker Helm Chart repository.


It’s time to install Spinnaker. Run the below command to deploy it in Kubernetes cluster.


The -f parameter points the installation to the default configuration saved in values.yaml. The –timeout parameter will force Helm to wait for at least five minutes before aborting with a timeout error. This tutorial is tested with version 0.3.5 which is mentioned by –version switch. Finally, we are installing the Helm Chart in a dedicated namespace called spinnaker configured through the –namespace switch.

After a few minutes, we should see the following output, which confirms the installation of Spinnaker.


In case you see a timeout error, delete the chart with helm del –purge kubelive command and run the install command again.

All the assets related to Spinnaker are deployed in the spinnaker namespace of the Kubernetes cluster. We can verify it with the below command.


Before we access the Spinnaker dashboard from the browser, we need to enable port forwarding by running the below commands. This exposes the Pod that runs the Spinnaker web UI to the host.


Spinnaker can now be accessed from the browser by visiting http://localhost:9000.

Deploying and Scaling a Containerized Application through Spinnaker

Let’s get familiar with Spinnaker concepts and terminology by deploying a simple Nginx web server.

Start by creating an application by clicking on Create Application under the Actions menu on the right top corner. An “application” here is a logical collection of various resources such as Load Balancers, Security Groups, Server Groups, and Clusters.

Let’s create a Load Balancer through which the application can be accessed. Click on the Load Balancer on the top menu bar, and then click on the Create Load Balancer button.

 

When creating a new Load Balancer, type prod as the stack name, 80 for Target Port, and choose NodePort as Type. Click on Create button when done.

Under Clusters, click on Create Server Group.

 

 

When creating a new Server Group, type prod as the stack name. Choose nginx:latest as the container from the dropdown. Choose nginx-prod as the Load Balancer, which we created in the previous step. Type 10 as capacity.

 

Under the Container setting, select Probes to create Readiness Probe and Liveness Probe with defaults. Finally, click on the Create button.

Wait for the instances under the Server Group to become available. The red colored blocks indicate that the instances are not ready yet.

Switch to the terminal, and run the following command to get the NodePort of the Service.


The Load Balancer created in Spinnaker is translated to a NodePort Service in Kubernetes. We now access this directly through the Minikube command.


Running kubectl get pods shows that there are 10 Pods created from Nginx container.


Expanding the Server Group in Spinnaker dashboard confirms the same.

This tutorial covered all the steps involved in getting Spinnaker up and running in a development environment. In the next part of the Spinnaker series, we will build an end-to-end CI/CD pipeline for Blue/Green deployments through Spinnaker. Stay tuned!

Additional editions of this series on learning Spinnaker will be found here. 

Group Created with Sketch.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.