Deploy the hive-server helm chart on AWS EKS
TypeScriptTo deploy the
hive-server
Helm chart on an Amazon EKS cluster using Pulumi, we'll go through a few steps:-
Create an EKS Cluster: We'll start by creating an EKS cluster where our applications will run. We'll use the
eks.Cluster
resource from Pulumi's EKS package to create the cluster. -
Deploy Helm Chart: Once we have the EKS cluster, we'll deploy the
hive-server
Helm chart using thekubernetes.helm.v3.Chart
resource from Pulumi's Kubernetes provider.
Below, you'll find a Pulumi program written in TypeScript that carries out these tasks. Each part of the program is commented to explain what it does:
import * as eks from '@pulumi/eks'; import * as pulumi from '@pulumi/pulumi'; import * as k8s from '@pulumi/kubernetes'; // Create an EKS cluster with the default configuration const cluster = new eks.Cluster('my-eks-cluster', { desiredCapacity: 2, // Sets the desired number of worker nodes minSize: 1, // Minimum number of worker nodes maxSize: 3, // Maximum number of worker nodes }); // Define the configuration for the hive-server helm chart const hiveServerChart = new k8s.helm.v3.Chart('hive-server', { chart: 'hive-server', version: '1.0.0', // replace with the desired version of the hive-server chart namespace: 'default', // specify the namespace if different from the default // Specify any custom values to configure the Helm chart. // For example, assume we need to provide a value for 'service.type' values: { service: { type: 'ClusterIP', }, }, }, { provider: cluster.provider }); // Ensure that Helm uses the EKS cluster we created // Export the kubeconfig of the EKS cluster to access it with kubectl export const kubeconfig = cluster.kubeconfig; // When running 'pulumi up', this program will first provision an EKS cluster // and then deploy the specified version of the hive-server Helm chart to it.
To execute this Pulumi program, perform the following steps:
- Install Pulumi and configure AWS credentials.
- Create a new directory for your project and initialize a new Pulumi project there.
- Install necessary NPM packages by running
npm install @pulumi/eks @pulumi/pulumi @pulumi/kubernetes
. - Save the above code as
index.ts
in your Pulumi project directory. - Run
pulumi up
to preview and deploy the changes.
The program will provision the necessary resources in your AWS account. Once the deployment is successful, you can use the exported
kubeconfig
to interact with your EKS cluster viakubectl
.Remember that in order to deploy a Helm chart, the Helm CLI needs to be installed on your system where you run
pulumi up
, as Pulumi's Helm provider uses the Helm CLI.For more information, please refer to the Pulumi documentation:
This example assumes that
hive-server
is a chart available in the default Helm repositories. If it's a custom chart or it requires a specific repository, you may need to provide additional configuration such asrepo
in theChart
resource options.-