Deploy the openunison-k8s-login-activedirectory helm chart on AWS EKS
TypeScriptTo accomplish the deployment of the
openunison-k8s-login-activedirectory
Helm chart on AWS EKS, we'll go through the following steps using Pulumi with TypeScript:- Create an Amazon EKS cluster.
- Deploy the Helm chart on our EKS cluster.
We'll use the following Pulumi resources:
eks.Cluster
from theeks
package to create an Amazon EKS cluster.kubernetes.helm.sh/v3.Chart
from thekubernetes
package to deploy the Helm chart.
Here is the Pulumi TypeScript program that accomplishes this deployment:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS cluster. const cluster = new eks.Cluster("my-cluster", { desiredCapacity: 2, // Number of worker nodes. minSize: 1, // Minimum number of worker nodes. maxSize: 3, // Maximum number of worker nodes. // Additional parameters can be set according to your requirements. }); // Step 2: Deploy the openunison-k8s-login-activedirectory Helm chart. const openunisonChart = new k8s.helm.v3.Chart("openunison-k8s-login-activedirectory", { chart: "openunison-k8s-login-activedirectory", // The repository where the Helm chart is located fetchOpts: { repo: "https://repo_url_where_chart_is_located/", }, // Values for the Helm chart values: { // You must provide the configuration details for Active Directory here. // This typically includes details such as the server URL, domain, and other required values. }, // Ensure that the Helm chart is deployed to the EKS cluster by providing the cluster's kubeconfig. kubeConfig: cluster.kubeconfig, }, { provider: cluster.provider }); // Export the Kubeconfig and the EKS cluster name. export const kubeconfig = cluster.kubeconfig; export const clusterName = cluster.core.cluster.name;
Explanation:
-
We begin by creating an EKS cluster using the
eks.Cluster
resource. In this case, thedesiredCapacity
,minSize
, andmaxSize
properties control the number of worker nodes in the cluster. You can adjust these numbers based on your application's requirements. -
Next, we deploy the Helm chart using the
k8s.helm.v3.Chart
resource. We specify the name of the Helm chart and the repository URL where it is stored. Thevalues
property should contain the specific configuration for your Active Directory setup, which you'll need to supply based on your environment. -
The chart is associated with the created EKS cluster by passing the cluster's
kubeconfig
as an input to the Helm chart resource; this communicates to Pulumi which cluster the Helm chart should be deployed onto. -
Finally, we export the
kubeconfig
and theclusterName
. Thekubeconfig
is useful for accessing your cluster viakubectl
or any Kubernetes management tool. TheclusterName
is provided for reference and potential use in further automation or integration.
Make sure to replace
https://repo_url_where_chart_is_located/
with the actual URL of the repository containing the Helm chart foropenunison-k8s-login-activedirectory
.To execute this Pulumi program, save it to a file named
index.ts
, and use the Pulumi CLI to create a new Pulumi project. Ensure you have configured your AWS credentials for Pulumi to use. Then run the following commands to deploy your infrastructure:pulumi stack init dev # Initialize a new stack called 'dev' pulumi up # Preview and deploy changes
After reviewing the preview shown by
pulumi up
, you can proceed to accept the deployment by selecting "yes" when prompted. Once the deployment is complete, you'll receive the outputs defined in the program, which you can use to interact with your new Kubernetes cluster.