Deploy the dapr-ambient helm chart on AWS EKS
TypeScriptIn order to deploy the
dapr-ambient
Helm chart on AWS EKS using Pulumi, we're going to take the following steps:- Create an EKS cluster, which will be our Kubernetes cluster environment managed by AWS.
- Create a node group for the EKS cluster, which will be a set of worker nodes where our applications will be scheduled.
- Deploy the
dapr-ambient
Helm chart to the EKS cluster.
We'll use the
@pulumi/eks
module to create the EKS cluster and node group, because it provides higher-level abstractions that simplify managing EKS clusters. This includes creating the VPC and other necessary AWS resources for EKS. For deploying the Helm chart, we'll use the@pulumi/kubernetes
provider which enables us to manage Kubernetes resources including Helm charts.Here's the TypeScript program to do the above:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS cluster. const cluster = new eks.Cluster("dapr-ambient-cluster", {}); // Step 2: Deploy the node group. const nodeGroup = cluster.createNodeGroup("dapr-ambient-nodegroup", { instanceType: "t2.medium", // You can change the instance type based on your workload. desiredCapacity: 2, // Number of instances to start with. }); // Step 3: Deploy the dapr-ambient helm chart to the EKS cluster. const daprChart = new k8s.helm.v3.Chart("dapr-ambient", { chart: "dapr-ambient", // Replace with the actual chart name if different. version: "x.y.z", // Replace with the actual chart version. fetchOpts: { repo: "http://<helm-chart-repository-url>", // Replace with the actual Helm chart repository URL. }, }, { provider: cluster.provider }); // This makes sure the chart is installed on our EKS cluster. // Export the Cluster's kubeconfig. export const kubeConfig = cluster.kubeconfig; // Export the Public Endpoint of the EKS Cluster. export const clusterEndpoint = cluster.kubeconfig.apply(config => config.cluster.server);
Explanation:
eks.Cluster
: Creates an AWS EKS cluster along with all the necessary components like the VPC, subnets, and security groups.cluster.createNodeGroup
: Adds a managed node group to the EKS cluster. You can select the instance type and specify the desired capacity based on your requirements.k8s.helm.v3.Chart
: Deploys a Helm chart to the Kubernetes cluster. Thechart
property should point to the name of the Helm chart andversion
to the specific chart version you want to deploy. Therepo
should be the URL to the Helm repository that stores thedapr-ambient
chart.
The
kubeConfig
is exported so that you can use this configuration to communicate with your Kubernetes cluster from your local machine usingkubectl
. TheclusterEndpoint
is the public API server endpoint for your EKS cluster, which you can use to access the Kubernetes dashboard or any other API-driven tools that interact with your cluster.Please replace the placeholders for
chart
,version
, andrepo
with actual values for thedapr-ambient
Helm chart that you're trying to deploy. If this is your first time using Pulumi or AWS EKS, please ensure you have the AWS CLI set up with the necessary permissions and Pulumi CLI installed and configured.Once you have this program ready, you can deploy your Pulumi stack by running:
pulumi up
This command provisions all the resources specified in the code. Pulumi provides detailed output of the resources being created, updated, or deleted. Once the deployment is successful, you should be able to use the provided kubeconfig to interact with your new EKS cluster and verify that the
dapr-ambient
Helm chart is deployed.