1. Deploy the mediawiki-dev helm chart on Kubernetes


    To deploy the mediawiki-dev Helm chart on a Kubernetes cluster using Pulumi, we will use the kubernetes.helm.v3.Chart class from the kubernetes package.

    The kubernetes.helm.v3.Chart class is a high-level Pulumi resource that enables deployment of Helm charts into a Kubernetes cluster. Using this resource in a Pulumi program will handle fetching the Helm chart from the specified repository, and deploying it into the Kubernetes cluster configured in your Pulumi environment.

    The Chart resource will need several pieces of information:

    1. chart: The name of the Helm chart you want to deploy.
    2. version (optional): The version of the Helm chart you want to deploy. If omitted, the latest version will be deployed.
    3. namespace (optional): The Kubernetes namespace to deploy the chart into. If omitted, the default namespace is used.
    4. values (optional): A set of values to customize the deployment, equivalent to what you would provide to a values.yaml file in Helm.

    Before running the Pulumi program make sure you have:

    • Installed Pulumi CLI and set up the Pulumi project with the appropriate stack.
    • Configured your Kubernetes cluster with kubectl, and Pulumi is able to access the cluster configuration.
    • Access to the Helm chart repository where mediawiki-dev is located.

    Here's a comprehensive program written in TypeScript that demonstrates how to accomplish your goal:

    import * as k8s from "@pulumi/kubernetes"; // Create a new instance of the Helm chart. // Replace `repoUrl` with the URL of the chart repository hosting `mediawiki-dev`. const mediawikiDevChart = new k8s.helm.v3.Chart("mediawiki-dev", { chart: "mediawiki-dev", // Uncomment the following if you know the version // version: "<CHART_VERSION>", // Uncomment the following if you want to specify a namespace // namespace: "<NAMESPACE>", // If the chart requires custom values, provide them here // values: { // This is a placeholder for the actual values you want to set // valueName: value, // }, // In case you need to specify a repository other than the default Helm repository // repo: "http://<HELM_CHART_REPOSITORY>" }); // Optional: Export the name of the namespace mediawiki-dev is deployed into export const namespace = mediawikiDevChart.namespace;

    In the above program:

    • We import the @pulumi/kubernetes package to access Kubernetes resources.
    • We create a Chart resource named mediawiki-dev. You need to use the chart name that is exactly as it's listed in your Helm repository of choice.
    • Since we haven’t specified a namespace, Pulumi will use the default namespace of the cluster.
    • To install a specific version of the chart or deploy to a specific namespace, uncomment and replace the placeholder comments with actual values.
    • The values: section is commented out, but that's where you would provide the custom values to configure the mediawiki-dev chart to fit your needs, just like you would with a values.yaml file when using Helm directly.
    • The repo: option is also commented out but can be used to pull from a specific Helm chart repository if needed.

    To run this Pulumi program:

    1. Save the code to a file (eg. index.ts) in a Pulumi project directory.
    2. Run pulumi up from your command line in the project directory.
    3. Pulumi will show a preview of the actions to be performed and ask for confirmation. If everything looks correct, you can confirm the deployment.

    The pulumi up command will start the deployment process. Pulumi will communicate with your Kubernetes cluster, upload the chart, and start deploying resources as per the chart definitions. If you want to see the output from Pulumi, you can monitor the progress in the command line interface.

    Once the deployment is done, Pulumi will output any exported values such as the namespace used for deploying the chart. You can now use kubectl to interact with your deployed mediawiki-dev application on your Kubernetes cluster.