Deploy the ed-deployment helm chart on AWS EKS
TypeScriptTo deploy the
ed-deployment
Helm chart on AWS EKS using Pulumi, you'll go through several steps:- Create an Amazon EKS cluster.
- Deploy a Helm chart to the EKS cluster.
Here's what each step will involve in the Pulumi program:
-
EKS Cluster: You'll define an EKS cluster with the necessary configurations using the
eks.Cluster
class. This will include specifying the VPC configurations, IAM roles, and any other required settings. -
Helm Chart: Once the cluster is set up, you'll use
kubernetes.helm.sh/v3.Chart
to deploy theed-deployment
Helm chart. This class allows you to specify the chart name, version, and any values to customize the deployment.
First, ensure you have the AWS and Kubernetes Pulumi providers configured for your environment.
Now let's go through the code:
import * as eks from "@pulumi/eks"; import * as awsx from "@pulumi/awsx"; import * as k8s from "@pulumi/kubernetes"; // Create a VPC for our cluster. const vpc = new awsx.ec2.Vpc("my-vpc"); // Specify the IAM role that will provide permissions for the EKS cluster // (this role and the instance profile can also be created using Pulumi if they do not exist). const clusterRole = //... existing IAM role ARN for the EKS cluster ... // Create an EKS cluster. const cluster = new eks.Cluster("my-cluster", { vpcId: vpc.id, subnetIds: vpc.publicSubnetIds, instanceType: "t2.medium", roleMappings: [{ roleArn: clusterRole, username: "admin", groups: ["system:masters"], }], createOidcProvider: true, providerCredentialOpts: { // Use an existing AWS IAM Role ARN if you have // Alternatively, use profileName: "<aws-profile-name>" }, }); // Deploy the "ed-deployment" helm chart to the EKS cluster. const chart = new k8s.helm.v3.Chart("ed-deployment", { chart: "ed-deployment", // Replace with actual repository or define `repo` to point to the right Helm repository version: "1.0.0", // specify the chart version namespace: "default", }, { provider: cluster.provider }); // Export the cluster kubeconfig and the public service endpoint once available export const kubeconfig = cluster.kubeconfig;
In this code:
awsx.ec2.Vpc
creates a new VPC; this is where the EKS cluster nodes will be placed.eks.Cluster
creates a new EKS cluster within the previously defined VPC.- The
k8s.helm.v3.Chart
class is used to deploy theed-deployment
Helm chart to the EKS cluster.
Make sure to replace placeholder values like
clusterRole
andversion
with the actual values relevant to your setup.This code is a complete program to deploy a Helm chart named
ed-deployment
to an EKS cluster on AWS. To run this program, save it to aindex.ts
file, install necessary dependencies withnpm install
oryarn add
for the@pulumi/eks
,@pulumi/awsx
, and@pulumi/kubernetes
packages, and usepulumi up
to launch.Note: The exact Helm chart name and version are placeholders in this example. You'll need access to the
ed-deployment
Helm chart or replace it with the name of a chart you want to deploy.