Deploy the argocd-instance helm chart on Kubernetes
TypeScriptTo deploy the
argocd-instance
Helm chart on a Kubernetes cluster using Pulumi, you will utilize thekubernetes.helm.v3.Chart
resource from the Pulumi Kubernetes provider. This allows you to manage Helm chart releases within your Pulumi program.Before you begin, ensure that you have the following prerequisites:
- Installed Pulumi CLI and set up your Pulumi project.
- Configured Kubernetes provider for Pulumi, which often involves having
kubectl
configured to communicate with your cluster or using a kubeconfig file. - Have access to a Kubernetes cluster where you can deploy the Helm chart.
The following TypeScript program will deploy the
argocd-instance
Helm chart into the default namespace of the connected Kubernetes cluster. In this example, we assume that the chart is publicly available in a Helm repository.import * as kubernetes from "@pulumi/kubernetes"; // Define the settings for the ArgoCD Helm chart const argoCDChart = new kubernetes.helm.v3.Chart("argocd-instance", { // Specify the chart name and repository details chart: "argo-cd", version: "4.10.15", // Use a specific version of the chart for consistency fetchOpts: { repo: "https://argoproj.github.io/argo-helm", // The Helm repository URL for ArgoCD }, // Provide custom values for the chart values: { // Customize the ArgoCD values as per your needs. Here is an example: server: { service: { type: "LoadBalancer", // Expose ArgoCD server using a LoadBalancer service }, }, }, }); // Export the ArgoCD server URL for easy access export const argoCDServerURL = argoCDChart .getResourceProperty("v1/Service", "argocd-instance-argo-cd-argocd-server", "status") .apply(status => `http://${status.loadBalancer.ingress[0].hostname}`);
Explanation:
- The
@pulumi/kubernetes
package is imported to access the Kubernetes resources that Pulumi provides. - An instance of
kubernetes.helm.v3.Chart
is created namedargocd-instance
. This represents the deployment of the ArgoCD Helm chart.- The
chart
property is set toargo-cd
, which is the name of the ArgoCD chart in the repository. - The
version
property specifies the version of the Helm chart that you want to deploy, which aids in ensuring deterministic deployments. - The
fetchOpts.repo
contains the URL to the Helm repository where the ArgoCD chart is hosted. - The
values
property allows you to customize the Helm chart parameters. Here, theserver.service.type
is set toLoadBalancer
to expose the ArgoCD server on an external IP provided by the cloud provider.
- The
- Finally, an export for
argoCDServerURL
is declared to fetch the LoadBalancer hostname/IP once ArgoCD is deployed, making it easier to access the ArgoCD server.
After running this Pulumi program, you'll deploy the
argocd-instance
Helm chart to your Kubernetes cluster. Please note, this example assumes all external dependencies, such as Helm repository access, are working as expected.For more information on using Helm charts with Pulumi, you can refer to the Pulumi documentation for Helm charts.