About Spinnaker
Spinnaker is a free and open-source continuous delivery software platform originally developed by Netflix and quickly picked up and extended by Google. It is designed to work with Kubernetes, Google Cloud Platform, AWS, Microsoft Azure and Oracle Cloud.
It automates the process of managing in the application deployment. It manages the application version, load balancer, etc.
Spinnaker provides two core sets of features:
- Application management
- Application deployment
1. Application Management
You use Spinnaker’s application management features to view and manage your cloud resources.
Modern tech organizations operate collections of services—sometimes referred to as “applications” or “microservices.” A Spinnaker application models this concept.
Applications, clusters, and server groups are the key concepts Spinnaker uses to describe your services. Load balancers and firewalls describe how your services are exposed to users.
Application
An application in Spinnaker is a collection of clusters, which in turn are collections of server groups. The application also includes firewalls and load balancers.
An application represents the service which you are going to deploy using Spinnaker, all configuration for that service, and all the infrastructure on which it will run.
You will typically create a different application for each service, though Spinnaker does not enforce that.
Read more about applications, and how to create and configure them, here.
Cluster
You can define Clusters, which are logical groupings of Server Groups in Spinnaker.
Note: cluster, here, does not map to a Kubernetes cluster. It’s merely a collection of Server Groups, irrespective of any Kubernetes clusters that might be included in your underlying architecture.
Server Group
The base resource, the Server Group, identifies the deployable artifact (VM image, Docker image, source location) and basic configuration settings such as number of instances, autoscaling policies, metadata, etc. This resource is optionally associated with a Load Balancer and a Firewall. When deployed, a Server Group is a collection of instances of the running software (VM instances, Kubernetes pods).
Load Balancer
A Load Balancer is associated with an ingress protocol and port range. It balances traffic among instances in its Server Groups. Optionally, you can enable health checks for a load balancer, with flexibility to define health criteria and specify the health check endpoint.
Firewall
A Firewall defines network traffic access. It is effectively a set of firewall rules defined by an IP range (CIDR) along with a communication protocol (e.g., TCP) and port range.
2. Application Deployment
You use Spinnaker’s application deployment features to construct and manage continuous delivery workflows.
The pipeline is the key deployment management construct in Spinnaker. It consists of a sequence of actions, known as stages. You can pass parameters from stage to stage along the pipeline.
You can start a pipeline manually, or you can configure it to be automatically triggered by an event, such as a Jenkins job completing, a new Docker image appearing in your registry, a CRON schedule, or a stage in another pipeline.
You can configure the pipeline to emit notifications, by email, Slack, or SMS, to interested parties at various points during pipeline execution (such as on pipeline start/complete/fail).
Stage
A Stage in Spinnaker is a collection of sequential Tasks and composed Stages that describe a higher-level action the Pipeline will perform either linearly or in parallel. You can sequence stages in a Pipeline in any order, though some stage sequences may be more common than others. Spinnaker provides a number of stages such as Deploy, Resize, Disable, Manual Judgment, and many more. You can see the full list of stages and read about implementation details for each provider in the Reference section.
Task
A Task in Spinnaker is an automatic function to perform.
Spinnaker treats cloud-native deployment strategies as first class constructs, handling the underlying orchestration such as verifying health checks, disabling old server groups and enabling new server groups. Spinnaker supports the red/black (a.k.a. blue/green) strategy, with rolling red/black and canary strategies in active development.
Who Should Use Spinnaker?
Use Spinnaker if you want to accelerate your software delivery velocity. If you’re currently shipping software once a quarter, start there. Use Spinnaker to automate that process and make it smoother.
Difference Between Jenkins and Spinnaker
- Jenkins is for Continuous Integration tool and Spinnaker is for Continuous Deployment
- Spinnaker is used to combine CI and CD for streamlined, multi-cloud deployments.
- Spinnaker is not a build tool
- Spinnaker takes advantage of existing build tools like Jenkins to start jobs and to monitor their progress and their results.
- Jenkins was never designed for cloud deployment so there is a need for external scripts to move the process forward.
- Spinnaker offers built-in support for creating load balancers, resizing clusters and rollbacks
- Spinnaker has an all-in-one dashboard that allows you to monitor compilation, baking, deployment and resource management for multiple cloud environments.
- Spinnaker Supports Comprehensive Set of Cloud Providers.
- Jenkins lacks capabilities as a complete deployment tool, especially for the cloud.
- Spinnaker has a richer deployment model with a master dashboard and native support for major cloud providers.
- Spinnaker still relies on a build server and must integrate with tools like Jenkins.
- Jenkins as a CI tool cannot be replaced by Spinnaker but Spinnaker can be used to make the deploy to cloud process much simpler.
More About Spinnaker Concepts
- Spinnaker provides us the robust pipeline framework.
- It composes series of stages-
Push the code into GitHub –> Jenkins to build artifacts –> Spinnaker picked up the Jenkins build artifacts and make it into am AMI and deploy that AMI to AWS.
Basic Spinnaker Screen
Load Balancer:
The Pipeline Screen:
Clicking on the Red part of execution, we will be able to expand it:
How to Delete an Application:
In order to delete the application, you first need to delete its server groups. To delete its server groups, select the ‘Clusters’ tab. Now select a server group to delete by clicking on it.
Now press the ‘Server Group Actions’ from the bar on the right hand side and press ‘Destroy’. Spinnaker will always ask you to confirm that you are going to delete this server group.
Once all the server groups have been deleted, navigate back to the ‘Config’->’Delete Application’ section and press “Delete Application’.
How to Create a Pipeline in Spinnaker?
- Under ‘Application’ Tab > Go to ‘Pipeline’ Tab
- Click on ‘Create’.
- Give name to the Pipeline.
Now, you will be able to see a screen like below:
- Now, click on ‘Add Stage’
- Select the type of stage you want to use.
Some type of stages are –
- Bake Stage
- Deploy Stage
- Manual Judgement Stage
- Check Preconditions
- Adding a Parallel Stage
- In Spinnaker we can use stages in parallel. It gives us flexibility to model wherever we want.
Integration of Spinnaker with Jenkins
Before you can make use of Jenkins in Spinnaker, you’ll need to configure access to your Jenkins masters.
- Firstly, we will start creating a spinnaker pipeline.
- Now we will open a terminal based to Halyad container that is our configuration for spinnaker.
- Now, we will follow the below commands,
- Enable Jenkins using the Halyard command:
hal config ci jenkins enable
- Spinnaker uses your Jenkins username and API token for authentication.
- Log into Jenkins
- Click on your username (in the top right)
- Click on “Configure” (on the left)
- Under the “API Token” section, click on “Add new Token”, and “Generate” and record the generated token
- Record your username; this is the value in the current page URL between ‘user’ and ‘configure’ (http:///user//configure)
hal config ci jenkins master add <jenkins-master-name> \
–address https://<jenkins-url>/ \
–username <jenkins-username> \
–password
[highlight color=”yellow”]You will be prompted for your Jenkins API token interactively[/highlight]
Now, apply your changes using
hal deploy apply
6. Now go back to the spinnaker window and click on ‘Save Changes’.
7. Then refresh the page. Now you will be able to see the Jenkin jobs present in the Automated Trigger.