Scaling .Net containers with Azure Kubernetes Service and Serverless ACI

 Background

Following my virtual session to the Microsoft Cloud South Florida user group last week, I was invited to deliver a similar virtual event. This time it was for Dear Azure user group in India. I am thankful to Kasam Shaikh the organizer of this event. The event was scheduled for Sunday afternoon. Given the relaxed time of 12:30 PM IST, we decided to have a 2 hours session. This was the first time I was present to the vibrant community in India. 

Scaling .Net Containers with AKS and Serverless ACI

The theme of the session is similar to the last one. The main difference here was the duration. We scheduled it for 2 hours and that provided me with an opportunity to do a deep dive on some of the topics. We started off by looking at the components of the application consisting of a Web API as Producer for RabbitMQ. Then we looked at the consumer which is built as .Net Core executable. We went through the steps of building Docker images using Docker compose. We also looked at the benefits of Docker. 

Next, we looked at private and public container registries. Kubernetes was our next logical step and we started by looking at the main features of Kubernetes.
RabbitMQ and KEDA were installed on Kubernetes cluster and the demo application was deployed using Kubernetes manifest files. In the closing stages of the demo, we looked at different options to scale a Kubernetes cluster. These included the manual scaling, Horizontal Pod Autoscaling (HPA) based on CPU or RAM utilization. There are cases when we need to scale not just on the resource usage but on some external factors. This is where we explored Kubernetes based Event Driven Autoscaling (KEDA). KEDA allows us to scale based on events.

Slight glitch

Usually, due to the time constraint, I prepare the demo environment beforehand and show the relevant bits during the live demo. This time since we had 2 hours at our disposal, I created the AKS clusters right at the start of the session. Most of the things which I wanted to show worked fine, except for a scenario of scaling onto the serverless Azure Container Instances (ACI). My backup cluster also had some problem. Lesson learnt that next time if I do a live cluster setup, the backup cluster needs to be tested thoroughly. I have done a similar demo at least 8-10 times in different forums. Maybe I became a bit overconfident that it would work.

YouTube video recording


The recording of this session is available on YouTube


Slides

The slides used during the session are available online
Slideshare - https://www.slideshare.net/nileshgule/scaling-containers-with-aks-and-aci

Conclusion

It was a wonderful experience to present to the vibrant developer community in India. The questions which were asked during the session prompted me to make changes to my demo which will be helpful for the future sessions. 

Until next time, Code with Passion and Strive for Excellence.
spacer

Automate SonarCloud code scans using GitHub Actions

 Background

In an earlier post / YouTube video, I had demonstrated how to automate code lining process using the GitHub Super Linter and GitHub action. In this post, we will explore how to use GitHub actions to automate the static code analysis using SonarCloud.

SonarCloud

You might have heard about SonarQube. It offers scanners for different programming languages. SonarCloud is cloud service which scans codebases for bugs, vulnerabilities and code smells. At the point of this writing, there are 24 mainstream programming languages supported which include:

  • C#
  • Java
  • Python
  • JavaScript
  • TypeScript
  • Go
  • Kotlin and others
SonarCloud provides detailed analysis across multiple dimensions of the code. These are helpful in identifying common mistakes done by developers and ensure that the code is of high quality. SonarCloud will also give an indicator of how much time is required to fix all the reported issues and remove the technical debt. The different dimensions are 
  • Reliability
  • Security
  • Maintainability
  • Coverage
  • Duplications

SonarCloud also has Quality Gates and Quality Profiles. Quality profiles can be used to refine the rules which are applied to the code while scanning the files.

Automate code scan with GitHub action

In the video, we can see how to use GitHub Action to automate the code scan using SonarCloud GitHub Action.


Conclusion

SonarCloud offers a very good analysis of codebase by performing static code analysis. The ruleset can be customized as per the language and also based on organization policies. GitHub Actions make it very easy to automate the workflows. Combining the power of GitHub action and the SonarCloud we get an up to date insights about our code in an automated manner. I hope you found this post useful.

Until next time, Code with Passion and Strive for Excellence
spacer