Deploy the Par helm chart on AWS EKS
TypeScriptTo deploy the Par helm chart on an AWS EKS cluster, we're going to create the infrastructure in a few steps:
-
Provision an EKS Cluster - We'll define an EKS cluster resource using Pulumi's
eks
package, which is a high-level component that creates and manages the necessary AWS infrastructure for EKS. -
Deploy the Helm Chart - After setting up the cluster, we'll use Pulumi's
kubernetes
provider to deploy the Par helm chart to the EKS cluster. This involves using theChart
resource from@pulumi/kubernetes/helm/v3
.
Here's a step-by-step Pulumi TypeScript program that will create an EKS cluster and deploy the Par helm chart:
import * as eks from "@pulumi/eks"; import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS cluster const cluster = new eks.Cluster("my-cluster", { // Define the necessary settings for the cluster: // Instance size, desired capacity, min and max, the version of Kubernetes, etc. instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 3, version: "1.21", }); // Export the cluster's kubeconfig to access it with kubectl export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the Par helm chart to the EKS cluster const parChart = new k8s.helm.v3.Chart("par-chart", { // Specify the Helm chart, version and the repository if it's an external one. chart: "par", version: "0.1.0", // The version might change, make sure to use the correct one. fetchOpts: { repo: "https://charts.example.com/", // Replace with the actual Helm chart repository URL for Par }, }, { provider: cluster.provider }); // The `kubeconfig` is automatically used to communicate with the cluster. // No further configuration is required unless the chart requires specific values.
Explanation:
-
We have created a new EKS cluster with a managed node group by instantiating
eks.Cluster
. We have set the instance type and scaling parameters for the node group. -
After the cluster is created, we also export the
kubeconfig
which can be used to interact with the Kubernetes cluster usingkubectl
or other Kubernetes tools. -
Then we deploy a Helm chart called "
par
" to the cluster. We have specified the version and provided the repository URL where the chart is located (you should replace this with the correct one for the Par chart).
Note:
-
Make sure to replace the chart version and the repository in the
parChart
with the correct ones. -
You might also need to include additional values for your Helm chart deployment, which can be passed to the
values
parameter of theChart
resource. -
This program assumes that you have the AWS CLI and Pulumi CLI installed and configured appropriately to create resources in your AWS account.
-
The EKS cluster creation may take about 15 minutes, and during its creation, the Pulumi program will output status updates.
Running the Program:
To apply this Pulumi program, you would:
- Save this code to a file named
index.ts
. - Run
pulumi up
in the same directory where the file is saved. - Inspect the preview shown by Pulumi.
- If everything looks good, confirm the deployment by selecting "yes".
The resources will be provisioned in the order defined, and you'll get the output of the
kubeconfig
if the operation is successful. You can then use thiskubeconfig
to interact with your newly deployed EKS cluster.-