1. Deploy the argocd-instance helm chart on Digital Ocean Kubernetes Service


    To deploy the Argo CD instance Helm chart on a Kubernetes cluster hosted on Digital Ocean, you will need to:

    1. Set up a Digital Ocean Kubernetes (DOKS) cluster.
    2. Install and configure the Helm CLI to work with the cluster.
    3. Use Pulumi to define the infrastructure in code and deploy the Helm chart into the cluster.

    Below you will find a Pulumi TypeScript program that:

    • Creates a new DOKS cluster.
    • Deploys the Argo CD instance Helm chart to this cluster.

    Please note that Helm charts can be defined as Pulumi resources using the kubernetes.helm.v3.Chart class, which is a part of Pulumi's Kubernetes provider.

    Let's go through the steps with explanations followed by the actual code.

    Set up Digital Ocean Kubernetes Cluster

    To create a Kubernetes cluster on Digital Ocean, we will make use of the digitalocean.KubernetesCluster resource. We will specify the region, version of Kubernetes, and details about node pools including size and number of nodes.

    Deploy Argo CD Helm Chart

    For deploying the argocd-instance Helm chart, we'll utilize the kubernetes.helm.v3.Chart resource which allows you to manage Helm chart deployments within Pulumi. We'll need to specify the repository and the chart name, along with any custom configurations which may be needed.

    import * as pulumi from "@pulumi/pulumi"; import * as digitalocean from "@pulumi/digitalocean"; import * as k8s from "@pulumi/kubernetes"; // Create a new Digital Ocean Kubernetes cluster. const cluster = new digitalocean.KubernetesCluster("do-cluster", { region: "nyc3", version: "1.21.5-do.0", nodePool: { name: "default", size: "s-2vcpu-2gb", nodeCount: 1, }, }); // Once the cluster is provisioned, we configure the Kubernetes provider with the kubeconfig. const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeConfigs[0].rawConfig, }); // Deploy the Argo CD instance helm chart. const argoCDChart = new k8s.helm.v3.Chart("argocd-chart", { chart: "argo-cd", version: "3.26.3", // specify the version of the chart fetchOpts: { repo: "https://argoproj.github.io/argo-helm", }, }, { provider: k8sProvider }); // Export the Digital Ocean Kubernetes cluster's kubeconfig so that you can interact with the cluster using kubectl. export const kubeconfig = cluster.kubeConfigs[0].rawConfig; // Export the Argo CD server URL by constructing it from the output properties of the installed chart. export const argoCDServerUrl = pulumi.interpolate`https://${argoCDChart.getResourceProperty("v1/Service", "argocd-server", "status").apply(status => status.loadBalancer.ingress[0].hostname)}`;

    In this program:

    • The digitalocean.KubernetesCluster object represents the DOKS cluster and the nodePool parameter is set up with a default pool with one s-2vcpu-2gb node.
    • The Pulumi Kubernetes provider (k8s.Provider) is configured with the kubeconfig from the newly created DOKS cluster.
    • The k8s.helm.v3.Chart object represents the Argo CD instance Helm chart, specifying the repository and version of the Helm chart to be deployed.
    • Finally, we export the kubeconfig for the newly created cluster, which can be used to manage the cluster with kubectl.
    • The Argo CD server URL is derived from the Helm chart's service status, which can be used to access the Argo CD UI.

    To work with these Pulumi resources, you first need to set up Pulumi and authenticate with your Digital Ocean account. Once you have Pulumi installed and configured, you can run pulumi up to create the infrastructure and deploy the Helm chart as described in the above code.