Deploy the ckan helm chart on AWS EKS
TypeScriptTo deploy a Helm chart on AWS EKS with Pulumi, you'll need to set up several components:
- AWS EKS Cluster: This will be the Kubernetes cluster environment where your Helm chart will be deployed.
- ECR Repository (optional): Container images used by the Helm chart can be stored in Elastic Container Registry.
- IAM Role: Required for EKS to manage resources on your behalf.
- Helm Chart: This will be your CKAN application packaged for Kubernetes deployment.
Here is the step-by-step guide and the associated Pulumi program written in TypeScript to accomplish this:
Prerequisites
Ensure you have the following installed:
- Pulumi CLI
- AWS CLI
- kubectl (configured to interact with Kubernetes clusters)
- Helm CLI (if you need to customize the chart before deployment)
Step 1: Set up an AWS EKS Cluster
First, we'll create an EKS cluster where your applications will be deployed. We'll use the
eks.Cluster
component from the Pulumi EKS package, which simplifies the cluster creation. For the sake of simplicity, we're going to use the default VPC and subnet settings.Step 2: Configure IAM Role for EKS
EKS requires an IAM role to create and manage resources on your behalf. We'll use the
aws-iam.EKSRole
component from the AWS IAM package.Step 3: Deploy the Helm Chart
With the cluster set up, you'll deploy the CKAN Helm chart using the
kubernetes.helm.v3.Chart
component from the Pulumi Kubernetes provider.Now, here's the Pulumi program that performs all these steps:
import * as eks from "@pulumi/eks"; import * as aws from "@pulumi/aws"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Create an EKS Cluster. const cluster = new eks.Cluster("my-cluster", { desiredCapacity: 2, minSize: 1, maxSize: 2, storageClasses: "gp2", deployDashboard: false, }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Once the cluster is created, you can deploy the ckan Helm chart like this: // (Replace `my-ckan-release` and `chart-version` with the appropriate names and versions) const ckanChart = new k8s.helm.v3.Chart("my-ckan-release", { chart: "ckan", version: "chart-version", fetchOpts: { repo: "https://helm.ckan.org/", }, }, { provider: cluster.provider }); // Export the necessary attributes of your application, like the load balancer endpoint. export const ckanEndpoint = ckanChart.getResourceProperty("v1/Service", "my-ckan-release-ckan", "status").apply(status => status.loadBalancer.ingress[0].hostname);
Explanation
- We import necessary Pulumi packages for EKS, AWS, Kubernetes, and the base Pulumi package.
- We create an EKS cluster using the
eks.Cluster
component. - We export the
kubeconfig
which you can use withkubectl
to interact with your Kubernetes cluster. - We deploy the CKAN Helm chart using
k8s.helm.v3.Chart
, specifying the chart name and version. You will have to replace"chart-version"
with the specific version of the CKAN chart you want to deploy. - We export the
ckanEndpoint
which you can use to access the CKAN service once the deployment is complete.
Wrapping Up
After running this Pulumi program with
pulumi up
, the CKAN Helm chart will be deployed to your AWS EKS cluster. You will get outputs of yourkubeconfig
and theckanEndpoint
upon successful deployment. Make sure you have the right access to AWS and that your Pulumi stack is correctly configured to deploy resources to your AWS account.This Pulumi program handles your infrastructure and application deployment, allowing you to maintain your entire stack in a single place with Infrastructure as Code (IaC) practices.