Blog
K8s and FlexDeploy

K8s and FlexDeploy – Deployment Strategies and More

With the release of FlexDeploy 5.2, we now have the ability to automate K8s Deployment Strategies as well as more native support for K8s. Because of this, we unfortunately have to say goodbye to the Helm Tab to make room for K8!

[row]
[column lg=”6″ md=”12″ sm=”12″ xs=”12″ ]

FlexDeploy 5.2

[/column]
[column lg=”6″ md=”12″ sm=”12″ xs=”12″ ]

FlexDeploy 5.1

[/column]
[/row]

This blog will require you to have a working knowledge of K8s and Deployment Strategies. Therefore, if you need a brush up you can check out this post or just Google around. (It’s your life!)

The Goal

Our objective is to deploy a new version of our ‘SpringBoot’ app into production. Furthermore, we want to do this in a way that doesn’t significantly hinder the user experience. In order to accomplish this, we are going to have the following:

The Project

The role of the Project is to export the manifest files from source and deploy the application to K8s. Along the way, any manifest files we specify for Deployment Strategies will also be applied. Below are some of the resources if you wish to create this yourself.

K8s Configuration

K8s Configuration

Making use of the new K8s tab, we are specifying the Deployment Name (1) as a Groovy script using the Project Version. In addition, the Manifest Files for deployment (2) and Canary Deployment Strategy (3) are also specified.

Upon opening the Istio-canary.yaml file, we can see one thing out of the ordinary. Notably, the ‘weight’ fields are using FlexDeploy Property Replacement.

route:
    - destination:
        port:
          number: 8080
        host: superapp
        subset: green
      weight: ${{FD_KN_OLD_WEIGHT}} 
    - destination:
        port:
          number: 8080
        host: superapp     
        subset: blue   
      weight: ${{FD_KN_NEW_WEIGHT}}

Keep this in mind as it will come into play later on.

The Pipeline

Now that the project is all setup, it’s time to showcase how exactly we are going to update our weights as we feel more confident with our new application version. To set the stage, this SpringBoot project is part of a Release using a Pipeline configured for Canary Deployments.

Canary Pipeline

Pipelines now come with a new Step called ‘Apply Deployment Strategy’, which has anywhere from 2-4 fields depending on your strategy. For instance, Canary is the selected strategy here and we can see it then prompts for ‘Old Weight‘ and ‘New Weight‘. These weights correlate to the FD_KN_OLD_WEIGHT and FD_KN_NEW_WEIGHT we saw in the Yaml configuration. Consequently, as we deploy to higher environments, we are directing more of the traffic to the Blue (new version) Pods. Finally, the Pipeline finishes with a Deployment to Production where 100 percent is routed to Blue and then Blue is cut-over to Green, thus completing our deployment.

Finishing Deployment

The Results

You may have noticed in the Pipeline that automated testing was done as well to validate the traffic. 10 requests were sent to the service with the output differing depending on whether the Blue or Green Pod was hit.

[table width =”100%” style =”” responsive =”false”]
[table_head]
[th_column]Environment[/th_column]
[th_column]Weights[/th_column]
[th_column]Test Results[/th_column]
[/table_head]
[table_body]
[table_row]
[row_column]Development[/row_column]
[row_column]10-Blue, 90-Green[/row_column]
[row_column]2-Blue, 8-Green[/row_column]
[/table_row]
[table_row]
[row_column]Test[/row_column]
[row_column]30-Blue, 70-Green[/row_column]
[row_column]3-Blue, 7-Green[/row_column]
[/table_row]
[table_row]
[row_column]QA[/row_column]
[row_column]50-Blue, 50-Green[/row_column]
[row_column]6-Blue, 4-Green[/row_column]
[/table_row]
[table_row]
[row_column]Production[/row_column]
[row_column]100-Blue, 0-Green[/row_column]
[row_column]10-Blue, 0-Green[/row_column]
[/table_row]
[/table_body]
[/table]

The Conclusion

So why wait any longer? Deployment strategies can reduce your time-to-market, help you discover and solve any issues, and increase IT team (and customer) morale.

Ready to get these benefits for yourself?

Start your DevOps journey!

Leave a Comment

Your email address will not be published.

Scroll to Top