Set up a Kubernetes cluster

In this tutorial, we will see how you can provision a secure, fault-tolerant infrastructure for running Kubernetes workloads without writing any code.

For this purpose, we will use Microtica’s provided components for VPC and Kubernetes.

#Prerequisites

To set up a Kubernetes cluster, you will first need to connect your AWS account and have already created a new environment.

Microtica handles all the cloud integration process for you, so you don’t have to worry about integration and writing custom scripts at all.

#Overview

In this tutorial, we will set up a Kubernetes cluster on AWS. Although we will use Microtica’s provided components, let’s go through the infrastructure resources that would be provisioned on AWS at the end of this tutorial.

  • VPC with
    • two private and two public subnets
    • Internet Gateway
    • NAT instance (t2.micro instance)
  • Kubernetes
    • EKS cluster
    • 1 node (t2.small instance) in auto-scaling group
    • Load balancer
    • Ambassador API Gateway

#Setting up the VPC

To set up a Kubernetes cluster, you first need an already created environment. If you haven’t created it yet, follow this tutorial to create an empty environment.

To set up a working Kubernetes Cluster, we need only 2 components as described in the overview: a VPC component and, of course, a Kubernetes Cluster component.

Go to your existing environment and choose AWS VPC Component from the Microtica Components tab from the right panel.

Microtica Environment playground

The next modal that appears is the component configuration modal.

VPC component configuration modal

The modal has the following fields:

  • Resource name – a friendly name for the component in this environment
  • Version – the version of the component you want to deploy. If you choose latest, then the latest version of the component will ALWAYS be deployed
  • keyName – the name of the EC2 key-pair
  • natInstanceType – NAT instance type. We leave the default value of t2.micro

To create a new EC2 key-pair, go to AWS console, choose EC2 service and from the left panel, choose Key Pairs, and click Create key pair in the top right.

AWS console – Create key pair
EC2 key-pair

You will need to create an EC2 key-pair from the AWS console. We don’t create it automatically due to security reasons. This key should always be in your possession and kept in a secure place. It will allow you to access your EC2 instances through SSH.

Once you are done with VPC component configuration, click on the Create button. As the VPC is now ready, let’s set up the Kubernetes cluster.

#Setting up the Kubernetes cluster

To set up a Kubernetes cluster, we will use another Microtica-provided component: AWS EKS Component. The component contains all necessary infrastructure configuration for our Kubernetes cluster.

To do this, go to your environment where we previously added VPC component. From the right panel under Microtica Components, select AWS EKS Component.

The next modal that appears is the component configuration modal.

EKS component configuration modal

The modal has the following fields:

  • Resource name – a friendly name for the component in this environment
  • Version – the version of the component to be deployed
  • vpcId – since we already created a VPC component we can simply reference that component
  • keyName – EC2 key-pair, we reference this value to the VPC component
  • subnets – referencing public and private subnets accordingly to the VPC component
  • minNodes – the minimum number of Kubernetes nodes in auto-scaling
  • maxNode – the maximum number of Kubernetes nodes in auto-scaling
  • nodeInstanceType – instance type of Kubernetes nodes (t2.small as default)
  • domainName (optional) – custom domain name on which the APIs will be exposed. For this tutorial, we will use the auto-generated domain name.
Referencing components

Microtica allows you to reference from components to other components.

In this case, we can reference to the VPC component from the EKS component, and Microtica will take care of providing actual values behind the scenes and respect the order of component provisioning.

Once you are done with the EKS component configuration, click on the Create button. Now we have a complete infrastructure setup ready for deployment.

#Deploying the infrastructure

To prepare for deployment click on the Create Plan button in the top right. The next page that appears is the deployment plan. All components that we’ve previously created are enlisted on this page with the appropriate action affected on your cloud account.

Click on Deploy button to confirm the plan and initiate deployment.

Microtica Environment deployment plan

Provisioning the entire Kubernetes infrastructure would take up to 15 minutes. With the infrastructure ready, you can start deploying your services on Kubernetes.

Follow the next getting started guide to deploy your first service on Kubernetes.