Bake and Deploy Pipeline
Set up a Spinnaker pipeline that bakes a VM image containing Redis, then deploys that image to a test cluster.
VM only: This codelab requires you have a VM (for example, on AWS or GCP) on which to run it.
For Kubernetes, try Kubernetes Source-to-Prod , or this one, for Azure .
To walk you through some of the basics with Spinnaker, you’re going to set up a Spinnaker pipeline that bakes a virtual machine (VM) image containing redis, then deploys that image to a test cluster.
Note here that the us-east-1a availability zone is currently full, so it will need to be deselected in the corresponding ‘region’ checkbox list for each of these steps.
Set up Spinnaker
If you don’t already have a running Spinnaker instance, you’ll need to set one up before you continue. A demo installation should be sufficient for this codelab, but you can also follow the full setup guide to try out Spinnaker with a full installation.
Once you have deployed Spinnaker, navigate to localhost:9000 to start this codelab.
Create a Spinnaker application
- In Spinnaker, click Actions > Create Application
- Input
example
for the Name field and your email address for the Owner Email field. - Click on the Consider only cloud provider health when executing tasks button next to Instance Health.
- Click the Create button.
Create and configure a firewall
Next, you’ll create a firewall that specifies traffic rules for the cluster. You’ll configure the rules to allow all incoming traffic on port 80, for clusters associated with this firewall.
- Click FIREWALLS, then click the + button to create a firewall.
- Input
test
for the Detail (optional) field andTest environment
for the Description field. - If running on AWS
- Select defaultvpc as the VPC field
- Click Add new Firewall Rule.
- Click default on the Firewall dropdown.
- Change Start Port and End Port to
80
.
- If running on GCP
- Click Add New Source CIDR and use the default
0.0.0.0/0
value for the Source Range field. - Click Add New Protocol and Port Range. Use the default
TCP
value for the Protocol field. Change Start Port and End Port to80
.
- Click the Create button.
Create a load balancer
Next, you’ll create a load balancer in Spinnaker.
- Click LOAD BALANCERS, then click the + button to create a load balancer.
- Input
test
for the Stack field. - If running on AWS, select internal (defaultvpc) from the VPC Subnet dropdown.
- Click the Next button.
- If running on AWS
- Select example-test from the Firewalls dropdown.
- Hit Next, then Create.
- If running on GCP
- Deselect the Enable health check? checkbox.
- Click the Create button.
Create a deployment pipeline
Your final task is to set up a Spinnaker pipeline. Let’s name it Bake & Deploy to Test. The pipeline will produce an image containing the redis-server
package and then deploy it. In this tutorial, you’ll trigger the pipeline manually.
To create the pipeline:
- Click PIPELINES, then click Configure and select Create New… from the dropdown.
- Input
Bake & Deploy to Test
for the Pipeline Name. - Click the Create Pipeline button.
Set up the first stage of the pipeline
You’re now going to create the first stage of the pipeline. It will build an image from an existing redis-server package.
- Click Add stage.
- Select Bake from the Type pulldown menu.
- Input
redis-server
for the Package field. - Click Save Changes.
Set up the second stage of the pipeline
You’re now going to set up the second stage of the pipeline. It takes the image constructed in the Bake stage and deploys it into a test environment.
- Click Add stage.
- Select Deploy from the Type dropdown.
- Under the Server Groups heading, click Add server group.
- Click the Continue without a template button.
Next, In the Configure Deployment Cluster window, input “test” for the Stack field.
- If running on AWS, select defaultvpc under VPC Subnet.
- Click the Next button.
- Click the text area next to the Load Balancers heading, then select
example-test
. Click the Next button. - Click the Firewalls form field, then click
example-test (example-test)
. Click the Next button. - If running on AWS
- Click on the Micro Utility button to set the Instance Profile, then click Next.
- Select the Medium: m3 size, then click Next.
- If running on GCP
- Click on the Micro Utility button to set the Instance Profile, then click Next.
- If running on GCP, select the Micro size, then click Next.
- Input
2
for the Number of Instances field, then click the Add button. - Save the pipeline configuration by clicking the Save Changes button.
Try it out!
- Click PIPELINES in the navigation bar.
- Click Start Manual Execution for the Bake & Deploy to Test pipeline.
- Click Run.
Now, watch Spinnaker in action. A MANUAL START section will appear, and will show progress as the pipeline executes. At any point during pipeline execution, click on the horizontal bar to see detailed status for any of the stages in the pipeline.
Feel free to navigate around the Spinnaker menus, create new pipelines, clusters, server groups, load balancers, and firewalls, etc. and see what happens.
When you’re ready to stop, don’t forget to cleanup your resources. An easy way to do this is to visit the pipelines, clusters, load balancers, and firewalls pages, click on the ones created and select the appropriate Delete command from the Actions pulldown on the right.
Last modified May 4, 2021: rest of migration (700781a)