Deploy the helm-amq-broker helm chart on AWS EKS
TypeScriptTo deploy the helm-amq-broker Helm chart on AWS Elastic Kubernetes Service (EKS), you'll need to complete the following steps:
-
Create an Amazon EKS Cluster: An EKS cluster is a managed Kubernetes service that makes it easy for you to run Kubernetes on AWS without needing to maintain your own Kubernetes control plane.
-
Deploy the helm-amq-broker Helm Chart: Helm is a package manager for Kubernetes that allows you to define, install, and upgrade even the most complex Kubernetes applications.
Here's how you can do this using Pulumi with TypeScript:
Step 1: Create an EKS Cluster
You'll use the
eks.Cluster
class from the Pulumi EKS package to create a new cluster. For more details, see the EKS Cluster documentation.import * as pulumi from "@pulumi/pulumi"; import * as awsx from "@pulumi/awsx"; import * as eks from "@pulumi/eks"; // Create an EKS cluster. const cluster = new eks.Cluster("my-cluster");
This will provision a new EKS cluster with default configurations, including the default node pool.
Step 2: Deploy the Helm chart
Next, you'll use the
helm.v3.Chart
resource from the Pulumi Kubernetes provider to deploy the helm-amq-broker chart to the cluster you created. We assume that the chart is available in a known Helm chart repository or as a local chart. For more information, check the Helm Chart documentation.import * as k8s from "@pulumi/kubernetes"; // Create a Kubernetes provider instance that uses our EKS cluster. const provider = new k8s.Provider("provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the helm-amq-broker helm chart. const amqBrokerChart = new k8s.helm.v3.Chart("amq-broker", { chart: "helm-amq-broker", version: "1.0.0", // replace with actual chart version fetchOpts: { repo: "http://your-chart-repository/", // replace with the URL of your chart repository }, }, { provider });
In this code,
kubeconfig
is obtained from the EKS cluster, which gives the Kubernetes provider the necessary configuration to interact with your cluster. Thehelm.v3.Chart
resource is then used to deploy thehelm-amq-broker
Helm chart.Remember to replace
"1.0.0"
with the actual version of the chart you intend to deploy, and"http://your-chart-repository/"
with the URL to the chart repository wherehelm-amq-broker
is hosted.The
provider
argument ensures that the Helm chart is installed on the EKS cluster you've provisioned.Complete Program
Here is the complete Pulumi program to deploy the helm-amq-broker chart on AWS EKS:
import * as pulumi from "@pulumi/pulumi"; import * as awsx from "@pulumi/awsx"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster with default settings. const cluster = new eks.Cluster("my-cluster"); // Create a Kubernetes provider instance that references our cluster's kubeconfig. const provider = new k8s.Provider("provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the helm-amq-broker helm chart using the Helm Chart resource. const amqBrokerChart = new k8s.helm.v3.Chart("amq-broker", { chart: "helm-amq-broker", version: "1.0.0", // Use the actual chart version fetchOpts: { repo: "http://your-chart-repository/", // Use the actual chart repository URL }, }, { provider }); // Export the kubeconfig and EKS cluster name. export const kubeconfig = cluster.kubeconfig; export const clusterName = cluster.eksCluster.name;
This program sets up an EKS cluster and deploys the
helm-amq-broker
Helm chart onto it. Thekubeconfig
and the cluster name are exported as stack outputs so that they can be easily accessed if needed (for instance, when you want to interact with your cluster usingkubectl
).Running the program
To run this Pulumi program:
- Ensure you have Pulumi installed and AWS credentials configured.
- Save the above program in a file named
index.ts
. - From the directory where
index.ts
is located, run the following commands:pulumi stack init dev pulumi up
- Confirm the preview looks correct and select
yes
to perform the deployment.
After deploying, Pulumi will provide you with the stack outputs, including the
kubeconfig
needed to connect to your new EKS cluster and manage resources.-