Deploy the voltha-etcd-cluster helm chart on AWS EKS
TypeScriptTo deploy the
voltha-etcd-cluster
helm chart on AWS EKS using Pulumi, you'll need to follow these steps:- First, you need to set up an EKS cluster on AWS.
- After the cluster setup, you'll use the Helm chart to deploy the
voltha-etcd-cluster
.
For setting up an EKS cluster with Pulumi, we'll use the
eks
package because it provides a high-level abstraction and simplifies the process. Once the cluster is ready, we'll proceed with deploying the Helm chart using thekubernetes
package, which enables Helm chart deployments on Kubernetes clusters including EKS.Below is a Pulumi program written in TypeScript that performs these steps:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Step 1: Create an EKS cluster on AWS. const cluster = new eks.Cluster("voltha-cluster", { instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 3, storageClasses: "gp2", // Choose a proper storage class if necessary. deployDashboard: false, // Dashboard is not typically recommended in production environments. }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the `voltha-etcd-cluster` Helm chart onto the EKS cluster created above. const volthaEtcdChart = new k8s.helm.v3.Chart("voltha-etcd", { chart: "etcd-cluster", // Assuming the Helm chart repository is added and 'etcd-cluster' is the chart name. // Replace '<REPO_NAME>' with the actual helm chart repository name. // Make sure that the chart version is compatible with `voltha-etcd-cluster` requirements. fetchOpts: { repo: "https://<REPO_NAME>", }, // If there are any specific configuration options, set them here. // For example, the number of replicas, values for resource limits, or any custom values required by the chart. values: { // Place your helm chart values here. }, namespace: "voltha", // Optionally specify the namespace where the chart should be deployed. Create it if necessary. }, { provider: cluster.provider }); // Ensure you set the provider to the EKS cluster. // Export the status of the deployed Helm chart. export const volthaEtcdStatus = volthaEtcdChart.status; // When deploying this Pulumi program, it will create an EKS cluster and deploy the `voltha-etcd-cluster` helm chart to it.
Before running this Pulumi program, you’ll need to:
- Install
Pulumi CLI
. - Set up AWS credentials for Pulumi.
- Add EKS to your Pulumi project by running
pulumi plugin install resource eks v1.0.3
. - Add Kubernetes to your Pulumi project by running
pulumi plugin install resource kubernetes v4.4.0
.
After preparing the environment:
- Save the above program in a file called
index.ts
. - Run
pulumi up
in your terminal from the directory containing this file. - Pulumi CLI will show you the expected changes. If everything looks good, select
yes
to proceed with the deployment. - Once the deployment is complete, Pulumi will output the kubeconfig and the status of the Helm chart deployment.
The chart deployment part of the program assumes that you've added the helm chart repository where
voltha-etcd-cluster
chart is hosted. You'll need to replacehttps://<REPO_NAME>
with the actual URL of the Helm chart repository. It also assumesetcd-cluster
is the correct name of the chart within that repository. Adjustments might be needed if the chart has different configuration parameters or if it’s hosted under a different name or repository.Remember to manage your Pulumi stack safely, especially since it could incur costs on AWS. When you're done with your deployment, you can destroy all the resources managed by Pulumi to avoid any further charges by running
pulumi destroy
.