Deploy the openshift-buildconfig helm chart on AWS EKS
TypeScriptTo deploy the
openshift-buildconfig
Helm chart on an AWS EKS cluster using Pulumi, you'll need to follow these general steps:- Set up an EKS cluster on AWS.
- Install the Helm chart into the EKS cluster.
Firstly, you'll need an EKS cluster. Using Pulumi's EKS package, you can create an EKS cluster with all the necessary configurations, like the VPC and node group.
After setting up the cluster, you'll apply the Helm chart into your cluster. Pulumi's Kubernetes provider can manage Kubernetes resources, including Helm charts.
Here is a detailed look at each step in TypeScript.
Step 1: Create an EKS Cluster on AWS
You'll need a VPC and IAM roles, but the
eks.Cluster
class abstracts most of this away for you. It is a high-level component that provisions an EKS cluster and deploys the necessary AWS resources.Step 2: Deploy the Helm Chart
Once the cluster is up and running, you can deploy Helm charts using the
kubernetes.helm.v3.Chart
resource from the Pulumi Kubernetes provider. You'll specify the Helm chart's repository, name, and version, along with any configuration settings or overrides.Here's a complete program that outlines these steps:
import * as pulumi from '@pulumi/pulumi'; import * as awsx from '@pulumi/awsx'; import * as eks from '@pulumi/eks'; // Pulumi EKS provider import * as k8s from '@pulumi/kubernetes'; // Pulumi Kubernetes provider // Step 1: Create an Amazon EKS cluster. const cluster = new eks.Cluster("my-eks-cluster", { desiredCapacity: 2, // Desired number of worker nodes. minSize: 1, // Minimum number of worker nodes. maxSize: 3, // Maximum number of worker nodes. storageClasses: "gp2", // The default storage class will be "gp2". deployDashboard: false, // Avoiding the deployment of the Kubernetes dashboard. }); // Export the cluster's kubeconfig to access it with kubectl. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the openshift-buildconfig Helm chart. const helmChart = new k8s.helm.v3.Chart("openshift-buildconfig", { chart: "openshift-buildconfig", version: "1.2.3", // Replace with the specific chart version you want to deploy. fetchOpts: { repo: "http://my-helm-chart-repo/", // Replace with the Helm chart's repository URL. }, // Add any configurations here, if necessary. }, { provider: cluster.getKubeconfig() }); // Ensure that we're installing into our EKS cluster. // Export the Helm chart resource name. export const helmChartName = helmChart.ready;
Explanation:
-
The
eks.Cluster
class creates an EKS cluster with some sensible defaults for node sizes and minimum/maximum scaling options. It includes the infrastructure pieces, like a VPC and security groups, required for the EKS cluster. -
The
k8s.helm.v3.Chart
resource deploys the specified Helm chart. ThefetchOpts.repo
is where you'd put the repository URL that hosts your Helm chart. Note that you should update thechart
,version
, and repository URL (repo
) to match theopenshift-buildconfig
chart you would like to deploy. -
We've disabled the deployment of the Kubernetes dashboard within the
eks.Cluster
by settingdeployDashboard: false
, and it's a general security best practice according to AWS.
Finally, after you have this code in a
.ts
file, you can create a new Pulumi stack with it (e.g.,pulumi stack init
), then runpulumi up
to provision the resources. Thekubeconfig
export gives you the information needed to connect to your EKS cluster withkubectl
.Remember, it's important to replace the placeholders, such as the chart version and repository URL, with actual values from your desired
openshift-buildconfig
Helm chart.