One-click Deployment on a Groundplex in Kubernetes with Elastic Scaling Using Terraform on AWS/Azure

18 Mar, 2022 | 3 minutes read

Introduction

Exploring and providing easier access when using different concepts and programs is always a challenge. And technology, now more than ever, is focused on automating processes and reducing the time needed to accomplish certain tasks. Our article focuses on achieving automation with one-click deployment of one or more groundplexes in Kubernetes while using Terraform. This can be accomplished in various cloud providers (in our case AWS and Azure).

Terraform creates and manages resources on cloud platforms and many other services through their application programming interfaces (APIs). Providers enable Terraform to work with virtually any platform or service with an accessible API.

The terraform workflow consists of:

  • Write – defining resources across multiple cloud providers and services
  • Plan – describing the infrastructure that will be created, updated or deleted
  • Apply – performing the proposed operations from the plan in the correct order

A brief overview of the architecture of AWS/Azure

  Our project contains the following infrastructure:

  • Infrastructure on AWS
A brief overview of the architecture of AWS/Azure

Technologies that are utilized for AWS:

  • Terraform – is an open-source infrastructure as a code software tool that provides a consistent CLI workflow to manage hundreds of cloud services.
  • AWS Resources – ( VPC, Internet Gateway, two Public and two Private groups, Nat Instance, two Private and one Public Route Groups,  Elastic Network Load Balancers and Elastic Container Kubernetes).
  • Helm
  • For monitoring: Prometheus and Grafana

Steps that we followed during the deployment on the Groundplex

One-click deployment on AWS is enabled by invoking a shell script in our case named fistclick.sh that contains the needed commands from terraform. As we can see in the picture below, these commands are doing terraform initialization, plan and deploy on our scripts:

Steps that we followed during the deployment on the Groundplex

With the execution of the shell script firstclick.sh, all of the resources needed for the groundplex deployment will be created on AWS. After all of the resources are created we use the local-exec provisioner feature from Terraform to update the kubeconfig file and invoke the shell script that will be responsible to deploy the groundplex in the Kubernetes cluster.

Steps that we followed during the deployment on the Groundplex

The commands defined inside the shell script groundplexdeployment.sh are used for the installation of the Helm charts for the monitoring tools (Prometheus and Grafana). Also, in this script, we create namespaces and deploy the groundplex in the Kubernetes cluster.

Steps that we followed during the deployment on the Groundplex
  • Infrastructure on Azure
Steps that we followed during the deployment on the Groundplex

Technologies that are utilized for Azure:

Terraform (Terraform Environment Variables)

For the one-click deployment on Azure similarly to AWS, we use shell script in combination with terraform environment variables.

Azure Resources – We use terraform variables to create the following resources: Resource Groups for Kubernetes cluster, Azure Kubernetes Cluster (AKS), Default Node pool for the cluster, Network Profile for the cluster.

To deploy the charts for Prometheus and Snaplogic and to create the namespaces in the Kubernetes cluster we use helm provider for terraform on Azure.

Bonus: Monitoring the groundplex on both cloud providers

After installing the Prometheus and Grafana charts for monitoring, we can use the SnapLogic pre-provided Grafana Dashboard:

SnapLogic pre-provided Grafana Dashboard

In the end, to check if the deployment was successful we can go to SnapLogic Dashboard, and based on the conditions that we have defined in auto-scaling in the SnapLogic helm chart, our deployed groundplex/es will appear:

Deployed groundplex/es

Conclusion

In this example, we have shown how we can automate the process of deploying groundplex/es in Kubernetes with only one click on different cloud providers while using the infrastructure as a code tool Terraform.

What are the benefits of using Terraform?

  • Increased productivity and efficiency
  • Automated changes
  • Collaboration (Allows commit in to a Version Control System)
  • Better planning and ability to reuse configuration files for multiple environments
  • Scalability and Agility

With the above-mentioned advantages, we can conclude that the benefit of using Terraform is that we will have our infrastructure ready much faster than using the traditional way of creating infrastructure, and we will be able to reuse the same process for as many environments as we want (Dev, Qa, Prod).