Managing Deployment of your Applications using Spinnaker
Using Spinnaker, you can manage deployments of your application in a consistent, repeatable and safe way through what is called a pipeline. In this tutorial, you will learn how to setup and deploy an application using OpsMx Spinnaker trial. You will learn how to:
- Create a pipeline
- Examine the pipeline stages
- Run the pipeline
- Manually control pipeline execution
Before you start, you need to login to Spinnaker. The registration email has the credentials to login. If you have not registered, .you can register for your trial here.
Creating a Pipeline
Upon successful login, click on Pipeline Templates to see the available templates. Click on Create Pipeline against Build Deploy Application to create a pipeline using that template. This template is configured to build and deploy a Java based application to a Kubernetes cluster. A template can be parameterized to allow deployment of similar applications using the same template.
Select the application you want to create your pipeline in. Application in Spinnaker is a grouping of your infrastructure in which your application is deployed. In your case, there is an application already created – select it. Click Continue.
Give your pipeline a name and click Continue.
Next you provide parameter values to a pipeline template. Since this template does not have any parameters to configure, you can dismiss the dialog that pops up.
Now it will show you the different stages in the pipeline. It is configured out of the box to run as is. You can examine the stages and their configuration by clicking on each stage.
Examine the Pipeline Stages
A stage is a unit of execution in a pipeline. Spinnaker supports a number of pipeline stages out-of-the-box. The stages available to your pipeline depends on the provider. The list of stages supported by Spinnaker out of the box can be found here. Here is a description of the stages in the pipeline you just created:
Configuration: You define the properties of a pipeline here. This is the first stage in any pipeline. Here you can define triggers to start the execution of your pipeline like checking a file to your git repository.
Build: Runs a Jenkins job that builds a Docker image.
Staging_Deploy: Deploys the docker image from the previous stage to a kubernetes account (dev-k8s-v2), In the deployment manifest definition, you can see how the image build in the “Build” stage is referenced.
Run Test Suite 1: This runs another Jenkins job that runs a bunch of tests against the deployed application.
Verify Test: This is a manual judgement stage – which is a stage where the user has to take a decision on whether to proceed or fail the execution of the pipeline.
Save your pipeline. Now you are ready to run your newly created pipeline.
Execute the Pipeline
As you have seen in the configuration stage, you can have automatic triggers on a pipeline. But you can also manually trigger a pipeline execution by clicking on Start Manual Execution.
The UI will show you the progress of the different pipeline stages. You can click on a stage to see the run details of that stage. Typically, the BuildDeployApplication pipeline takes 4 minutes to complete.
Manual Control Pipeline Execution
Remember the Verify Test is a manual judgement stage. The pipeline will wait here for the user to take an action. Select a reason and click on Continue to complete the pipeline run (or you can click on Stop to stop further execution of the pipeline!).
Conclusion
By now, you should have your application built and deployed in your environment. There are a few more pipeline templates available for you to explore. You can create piplelines out of them, review their stages and run them.
Build Deploy Promote Application: This pipeline demonstrates the deployment rollout strategy options. This pipeline deploys the build from the Build Deploy Application pipeline to production Kubernetes enabling red/black deployment strategy.
Deploy To Prod: This demonstrates the calling of another pipeline from a pipeline. This technique allows you to chain pipelines and build a complex deployment workflow.