Deploy the k8s-pvc helm chart on AWS EKS
TypeScriptTo deploy a Kubernetes (k8s) Persistent Volume Claim (PVC) Helm chart on AWS EKS (Elastic Kubernetes Service), we'll need to follow several steps:
- Set up an AWS EKS cluster.
- Install the Helm CLI tool, if not already installed.
- Add the Helm chart repository that contains the k8s-pvc chart.
- Deploy the PVC chart to the EKS cluster using Helm.
Below is a Pulumi program written in TypeScript that sets up an EKS cluster. Once the cluster is running, you can use the Helm CLI to deploy your PVC Helm chart to that cluster. The code uses
eks.Cluster
from thepulumi/eks
module, which wraps the EKS resources in an easy-to-use component.Note: Ensure that you have AWS and EKS CLI tools installed and configured as well as Helm 3.
Here's the complete Pulumi program to create an AWS EKS cluster:
import * as eks from "@pulumi/eks"; // Create an EKS cluster. const cluster = new eks.Cluster("my-cluster", { desiredCapacity: 2, minSize: 1, maxSize: 2, storageClasses: "gp2", // gp2 is the General Purpose SSD storage class. Adjust as needed. // Define the EKS cluster version, feel free to adjust it to the version you need. version: "1.21", // Other cluster configuration settings... }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // After the cluster is created, use Helm to deploy the PVC chart: // `helm repo add <repo-name> <repo-url>` // `helm install my-pvc <repo-name>/k8s-pvc`
To use the Helm CLI after the cluster is up and running, follow these steps:
-
Add the repository that contains the
k8s-pvc
Helm chart (Replace<repo-name>
with the name of the repository and<repo-url>
with the repository URL):helm repo add <repo-name> <repo-url>
-
Install the
k8s-pvc
Helm chart into your cluster (Replace<repo-name>
with the name of the repository where thek8s-pvc
chart is located):helm install my-pvc <repo-name>/k8s-pvc
Ensure that your KUBECONFIG environment variable is set correctly (pointing to the
kubeconfig
output from Pulumi), or pass the kubeconfig file to Helm commands using--kubeconfig path/to/kubeconfig
.This program will:
- Provision an EKS cluster with a predefined managed node group size using AWS EKS managed service.
- Output the kubeconfig file necessary to interact with the cluster using
kubectl
or Helm.
After the EKS cluster is created using Pulumi, you can install the PVC Helm chart or any other Helm charts using the Helm CLI tool as you would normally do in your CI/CD system or local environment.
For more details on EKS with Pulumi, refer to the EKS documentation. For the
eks.Cluster
component, specific documentation can be found here.