1. Deploy the pmm-server helm chart on Digital Ocean Kubernetes Service


    To deploy the pmm-server Helm chart on DigitalOcean Kubernetes Service (DOKS), you will follow these steps:

    1. Create a DigitalOcean Kubernetes cluster.
    2. Deploy the pmm-server Helm chart to the Kubernetes cluster.

    We will use the @pulumi/digitalocean package to create a Kubernetes cluster on DigitalOcean and the @pulumi/kubernetes package to deploy the pmm-server Helm chart onto the created cluster.

    First, ensure you have the Pulumi CLI installed and DigitalOcean access configured correctly. Once the setup is ready, you can write a Pulumi program in TypeScript as shown below:

    import * as pulumi from "@pulumi/pulumi"; import * as digitalocean from "@pulumi/digitalocean"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create a DigitalOcean Kubernetes cluster const cluster = new digitalocean.KubernetesCluster("do-cluster", { region: "nyc3", // You can select your preferred region version: "latest", // Specifies the latest version of Kubernetes nodePool: { name: "default", size: "s-2vcpu-2gb", // This is the node size, can be adjusted based on your needs nodeCount: 2, // Number of nodes in the node pool }, }); // Export the kubeconfig so we can easily access our cluster export const kubeconfig = cluster.kubeConfigs[0].rawConfig; // Step 2: Deploy the `pmm-server` Helm chart onto the cluster const pmmServerChart = new k8s.helm.v3.Chart("pmm-server", { chart: "pmm-server", version: "2.26.0", // You should specify the chart version you want to deploy fetchOpts: { repo: "https://percona.github.io/percona-helm-charts/", // This is the Helm repository URL for pmm-server }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeConfigs[0].rawConfig }) }); // Note that we passed a custom provider to the Helm chart resource because we wanted to use the kubeconfig from the newly created DigitalOcean Kubernetes cluster.

    Here's an explanation of the code:

    • Import the required Pulumi packages for DigitalOcean and Kubernetes.
    • Create a new DigitalOcean Kubernetes cluster (KubernetesCluster) in the specified region with a default node pool with a specific size and node count.
    • Export the Kubernetes cluster's kubeconfig which is used to connect to the cluster with tools like kubectl.
    • Use the Chart class from the @pulumi/kubernetes package to deploy the pmm-server Helm chart from the provided repository.
    • We need to create a Kubernetes provider with the kubeconfig from the DigitalOcean cluster to let Pulumi know this Helm chart should be deployed to the new cluster.

    With this setup, running pulumi up will create the Kubernetes cluster and then deploy the Helm chart.

    Keep in mind, Helm charts can have configuration values that customize the deployment. If you need to provide specific values for pmm-server, you can include a values object within the Chart resource. For example:

    const pmmServerChart = new k8s.helm.v3.Chart("pmm-server", { chart: "pmm-server", version: "2.26.0", fetchOpts: { repo: "https://percona.github.io/percona-helm-charts/", }, values: { // Custom values for your PMM server configuration persistence: { size: "8Gi", }, resources: { limits: { cpu: "200m", memory: "512Mi", }, }, }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeConfigs[0].rawConfig }) });

    Make sure to replace the values in the values object with the ones that fit your needs for the pmm-server. You should consult the chart's documentation for configurable settings.

    To obtain the exposed endpoints or any other outputs once deployed, you can use Pulumi's stack export feature. For the Helm chart, this could include service URLs or other related data.