Deploy the unleash-proxy helm chart on AWS EKS
TypeScriptTo deploy the
unleash-proxy
Helm chart on AWS EKS using Pulumi, you will need to follow these steps:-
Create an EKS Cluster: First, you'll set up an Amazon EKS cluster. Amazon Elastic Kubernetes Service (Amazon EKS) is a managed Kubernetes service that makes it easy to run Kubernetes on AWS and on-premises.
-
Deploy Helm Chart to the Cluster: Once the cluster is running, you will deploy the
unleash-proxy
Helm chart to your EKS cluster. Helm charts are packages of pre-configured Kubernetes resources that can be used to deploy applications or services to a Kubernetes cluster.
Below is the TypeScript Pulumi program that carries out these steps. This program assumes that you have
aws
andkubernetes
providers configured with the appropriate credentials for your AWS account.import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as awsx from "@pulumi/awsx"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create a VPC for our cluster. const vpc = new awsx.ec2.Vpc("unleashVpc", { numberOfAvailabilityZones: 2 }); // Create an EKS cluster with the default configuration. const cluster = new eks.Cluster("unleashCluster", { vpcId: vpc.id, publicSubnetIds: vpc.publicSubnetIds, privateSubnetIds: vpc.privateSubnetIds, desiredCapacity: 2, minSize: 1, maxSize: 2, storageClasses: "gp2", // Specify the storage class. deployDashboard: false, // Kubernetes dashboard is not recommended in AWS. }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider instance that uses our EKS cluster. const provider = new k8s.Provider("k8sProvider", { kubeconfig: kubeconfig.apply(JSON.stringify), }); // Deploy the unleash-proxy Helm chart to the EKS cluster. const unleashChart = new k8s.helm.v3.Chart("unleashProxy", { chart: "unleash-proxy", version: "1.0.0", // Replace with the desired chart version fetchOpts: { repo: "http://charts.unleash-hosted.com", // Replace with the repository that contains the unleash-proxy chart }, }, { provider }); // Export the URL to access the Unleash Dashboard (Modify to correct resource once known) export const unleashDashboardUrl = pulumi.interpolate`http://${unleashChart.status.loadBalancer.ingress[0].hostname}/`;
This program does the following:
-
VPC Creation: Sets up a new VPC in AWS with a certain number of Availability Zones using the
awsx
library, which provides higher level abstractions for AWS resources. -
EKS Cluster Creation: Initializes an EKS cluster within the VPC. The
eks.Cluster
class from the@pulumi/eks
module helps create and manage EKS cluster resources. The cluster is configured to manage its node groups for running workloads. -
Kubernetes Provider Configuration: Utilizes the kubeconfig generated by the EKS cluster to configure a Kubernetes provider.
-
Helm Chart Deployment: Deploys the
unleash-proxy
Helm chart into the EKS cluster using the Kubernetes provider. The Helm chart is fetched from its Helm repository. -
Access Unleash Dashboard: After successful deployment, it exports a URL that you would use to access the Unleash Proxy dashboard. (Note: You might need to adapt the
unleashDashboardUrl
to point to the right resource; this is demonstrative and could vary depending on the service exposed by your Helm chart.)
To apply this Pulumi program:
-
Save the above code to a file named
index.ts
. -
Install the required Pulumi packages by running:
npm install @pulumi/pulumi @pulumi/aws @pulumi/awsx @pulumi/eks @pulumi/kubernetes
-
Run
pulumi up
to create the resources. Follow the prompts by the CLI to preview and accept the changes.
Please adjust the program as necessary to match your exact use case, especially the Helm chart version and repository.
-