Deploy the ublhub helm chart on AWS EKS
TypeScriptTo deploy the
ublhub
Helm chart on AWS EKS using Pulumi, you'll need to perform a series of steps. These steps include setting up an EKS cluster, then using the Helm package manager to install your chart. We'll be writing this program in TypeScript.Here's an outline of the tasks we're going to perform:
- Create an EKS cluster.
- Deploy the
ublhub
Helm chart to the cluster.
Below is a Pulumi TypeScript program that accomplishes these tasks:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS cluster // Create an EKS cluster with the default configuration. const cluster = new eks.Cluster("my-cluster", {}); // Step 2: Deploy the `ublhub` Helm chart to the cluster // Instantiate a Kubernetes provider pointing to the created cluster. const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the `ublhub` helm chart using the created Kubernetes provider. // Here you need to replace `<repo-name>` with the name of the Helm repository that contains the `ublhub` chart // and `<chart-version>` with the version of the helm chart you want to deploy. const helmChart = new k8s.helm.v3.Chart("ublhub-chart", { repo: "<repo-name>", chart: "ublhub", version: "<chart-version>" }, { provider: k8sProvider }); // Export the cluster's kubeconfig and the chart's status as an output. export const kubeconfig = cluster.kubeconfig; export const helmChartStatus = helmChart.status;
In this program:
-
We import the necessary Pulumi EKS and Kubernetes packages.
-
We create an EKS cluster named
my-cluster
with the default settings provided by the@pulumi/eks
package. You can learn more about this in the Pulumi EKS Cluster documentation. -
Once the cluster is available, we create a Pulumi Kubernetes provider that uses the kubeconfig of the EKS cluster. This allows Pulumi to perform Kubernetes operations such as deploying apps on that cluster.
-
We use the Pulumi Kubernetes Helm package to declare a new Helm chart resource. This represents the
ublhub
Helm chart. You will need to replace<repo-name>
with the name of the Helm repository where your chart is located and<chart-version>
with the specific chart version you intend to deploy. -
Lastly, we export two pieces of information:
- The
kubeconfig
of the cluster for you to access your EKS cluster. - The
helmChartStatus
to show the install status of theublhub
Helm chart.
- The
To run this Pulumi program:
- Ensure Pulumi, and the AWS CLI are installed and properly configured on your machine.
- Create a new directory and navigate into it.
- Run
pulumi new typescript
to create a new Pulumi project. - Replace the contents of
index.ts
in your project directory with the code above. - Run
npm install @pulumi/eks @pulumi/kubernetes
to install the necessary dependencies. - Substitute the placeholder values for the Helm chart repository name and version with actual values you intend to deploy.
- Run
pulumi up
to create the resources and deploy the Helm chart to your EKS cluster.
Remember, before running
pulumi up
, ensure that you have theAWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
environment variables set up for Pulumi to access your AWS account, or that you are authenticated via the AWS CLI.