Deploy the argo-cr helm chart on AWS EKS
TypeScriptTo deploy the Argo CD Helm chart on an AWS EKS cluster, you need to follow these steps:
- Set up an EKS cluster: Use the
eks.Cluster
resource to create a new EKS cluster. This includes creating an EKS role, VPC, subnets, and any other required AWS resources. - Configure the Kubernetes provider: After the EKS cluster is up and running, configure the Kubernetes provider to interact with the cluster.
- Install Argo CD: Use the
kubernetes.helm.v3.Chart
resource to deploy the Argo CD Helm chart to your EKS cluster.
Before you start, ensure that you have the Pulumi CLI and AWS CLI installed and configured for use.
Here's a program that demonstrates how to accomplish this:
import * as pulumi from '@pulumi/pulumi'; import * as aws from '@pulumi/aws'; import * as eks from '@pulumi/eks'; import * as k8s from '@pulumi/kubernetes'; // Create an EKS cluster. const cluster = new eks.Cluster('my-cluster', { // Specify the desired Kubernetes version (for example, "1.21") version: '1.21', }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Kubernetes provider to interact with the EKS cluster. const provider = new k8s.Provider('k8s-provider', { kubeconfig: cluster.kubeconfig, }); // Deploy the Argo CD Helm chart to the EKS cluster. const argoCDChart = new k8s.helm.v3.Chart('argo-cd', { chart: 'argo-cd', version: '3.2.3', // Use the desired chart version fetchOpts: { repo: 'https://argoproj.github.io/argo-helm', }, }, { provider }); // Export the Argo CD server URL by querying the load balancer created by its service. export const argoCdServerUrl = argoCDChart.getResourceProperty('v1/Service', 'argo-cd/argo-cd-server', 'status').apply(status => { const ingress = status.loadBalancer.ingress[0]; return ingress.hostname || ingress.ip; });
Here's a breakdown of the above program:
- We use the
eks
package to create an EKS cluster. This simplifies the setup and manages the underlying resources automatically. - We extract the
kubeconfig
from the newly created cluster in order to interact with it using the Kubernetes provider. - We create a new instance of the
k8s.Provider
class, providing it with the kubeconfig of the EKS cluster. This allows Pulumi to interact with your EKS cluster to deploy Kubernetes resources. - We install the Argo CD Helm chart into the EKS cluster using the
k8s.helm.v3.Chart
class, which is a high-level resource that encapsulates deploying Helm charts on a Kubernetes cluster. - Finally, we export the
argoCdServerUrl
, which queries the Kubernetes Service to get the hostname or IP address where the Argo CD server is accessible.
Remember to replace the
version
of the EKS cluster andversion
of the Argo CD Helm chart with the versions you wish to use.After your Pulumi program is set up, you will run the following commands to deploy the resources:
pulumi up
This will prompt you to confirm the deployment after showing you a preview of the resources that will be created.
To access the Argo CD UI after deployment is complete, you can use the output of
argoCdServerUrl
and access it in your web browser. To interact with your EKS cluster, you will use the outputkubeconfig
.- Set up an EKS cluster: Use the