Deploy the microcks helm chart on AWS EKS
TypeScriptTo deploy the Microcks Helm chart on AWS EKS, we'll go through a series of steps with Pulumi. First, we will create an Amazon Elastic Kubernetes Service (EKS) cluster, then we will create an Amazon Elastic Container Registry (ECR) if needed to store any container images, and finally deploy the Microcks Helm chart to our EKS cluster.
1. Creating an Amazon EKS Cluster
First, we need to set up the EKS cluster. We'll use the
eks.Cluster
resource, which is a high-level API provided by Pulumi to create and manage EKS clusters. This resource simplifies creating the cluster by abstracting away the underlying resources such as the worker nodes, IAM roles, and VPC configurations typically associated with an EKS cluster.Reference:
eks.Cluster
2. Installing the Microcks Helm Chart
For the Helm chart deployment, we'll use the
helm.v3.Chart
resource from Pulumi's@pulumi/kubernetes
package. This resource will configure and deploy the Microcks Helm chart to our EKS cluster. We have to ensure that Helm and the required repositories are configured in our local environment where Pulumi will run.Prerequisites
Before you can run the Pulumi program, ensure you have:
- Installed Pulumi CLI and set up the AWS provider.
- Configured AWS credentials to interact with your AWS account.
- Kubernetes CLI (kubectl) configured to interact with the EKS cluster.
- Added the Microcks Helm chart repository to your Helm CLI.
Now, here's how you can write the Pulumi program to accomplish this:
import * as eks from "@pulumi/eks"; import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster. const cluster = new eks.Cluster("microcks-cluster", { instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 3, storageClasses: "gp2", deployDashboard: false, }); // Export the clusters' kubeconfig. export const kubeconfig = cluster.kubeconfig; // Deploy Microcks Helm chart to EKS cluster. const microcksChart = new k8s.helm.v3.Chart("microcks", { chart: "microcks", version: "1.0.0", // specify the exact chart version fetchOpts: { repo: "https://microcks.io/helm", // The chart repository }, namespace: "microcks", // Specify any values you want to override provided by the chart's `values.yaml`. values: { replicas: 1, serviceType: "LoadBalancer", // ... add other values as per the chart's configuration }, }, { provider: cluster.provider }); // Export the Microcks service URL by querying the LoadBalancer after deployment // The LoadBalancer URL will be in the status of the `Service` resource that the Microcks chart creates. const microcksService = microcksChart.getResource("v1/Service", "microcks/microcks"); export const microcksUrl = microcksService.status.loadBalancer.ingress[0].hostname.apply(hostname => `http://${hostname}`);
Explanation
-
The
eks.Cluster
call creates a managed EKS cluster. We've configured it to uset2.medium
instances, and allowed the autoscaling group to adjust between 1 to 3 instances as needed. -
The
helm.v3.Chart
call deploys the Microcks Helm chart to the EKS cluster we just created. ThefetchOpts
block specifies the Helm repository to pull the Microcks chart from, and thevalues
block allows overriding default values provided by the Microcksvalues.yaml
file. -
We're also exporting the
kubeconfig
which will allow you to interact with your Kubernetes cluster usingkubectl
. -
Finally, we export the URL of the Microcks service, which is exposed by a LoadBalancer. You can use this URL to access the Microcks UI once deployed.
This is a high-level overview, and the specifics of the configuration may need to be adapted to your AWS environment and Microcks configuration requirements. Please ensure that your AWS account limits allow for the resources that are being created and that you're aware of the costs associated with your EKS cluster and its related services.