Deploy the argocd-instance helm chart on AWS EKS
TypeScriptTo deploy the
argocd-instance
Helm chart on AWS EKS using Pulumi, you will follow these steps:- Create an EKS cluster.
- Deploy the
argocd-instance
Helm chart to the EKS cluster.
To achieve step 1, we'll use the
eks.Cluster
resource from theeks
package as it provides a high-level abstraction for managing EKS clusters. This abstracts away many of the details for creating an EKS cluster, making it simpler to use, especially for novices.For the second step, the
kubernetes.helm.sh/v3.Chart
resource from thekubernetes
package will enable you to deploy a Helm chart onto a Kubernetes cluster.Let's begin with a complete Pulumi TypeScript program that defines both these resources:
import * as pulumi from '@pulumi/pulumi'; import * as eks from '@pulumi/eks'; import * as k8s from '@pulumi/kubernetes'; // Create an EKS cluster. const cluster = new eks.Cluster('my-cluster', { desiredCapacity: 2, minSize: 1, maxSize: 3, storageClasses: "gp2", deployDashboard: false, }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Use the kubeconfig from the generated EKS cluster to interact with the cluster's Kubernetes API server. const k8sProvider = new k8s.Provider('k8s-provider', { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the argocd-instance Helm chart on the EKS cluster. const argoCDChart = new k8s.helm.sh.v3.Chart('argo-cd', { chart: 'argo-cd', version: '3.2.3', // replace with the desired chart version fetchOpts:{ repo: 'https://argoproj.github.io/argo-helm', }, }, { provider: k8sProvider });
Here is what each part of the program does:
-
eks.Cluster
creates an EKS cluster, with the desired, minimum, and maximum number of worker nodes indicated. The storage classes for persistent storage are set, and the Kubernetes dashboard is not deployed for security reasons. -
Exporting
kubeconfig
allows you to interact with your cluster using thekubectl
command-line tool once the Pulumi program completes. -
k8s.Provider
is a Pulumi resource representing a Kubernetes provider that uses the generatedkubeconfig
to interact with the EKS cluster we just created. -
k8s.helm.sh/v3.Chart
is used to deploy theargo-cd
Helm chart to the Kubernetes cluster. Replace'3.2.3'
with the desired version of the Helm chart you want to deploy. Therepo
option specifies the Helm repository where theargo-cd
chart can be found.
Before you start, ensure that you have Pulumi CLI installed, your AWS credentials configured for Pulumi, and Helm CLI installed for Helm operations if needed.
Lastly, execute
pulumi up
to create the resources as defined. Pulumi will perform the deployment, and once done, you can use theargo-cd
service on your new EKS cluster.For further details on the resources used, refer to the following documentation: