Deploy the mediawiki-dev helm chart on Google Kubernetes Engine (GKE)
TypeScriptIn order to deploy the
mediawiki-dev
Helm chart on Google Kubernetes Engine (GKE), you'll need to follow these steps:- Create a GKE cluster: This involves setting up a Kubernetes cluster on GKE, which serves as the environment where your applications will run.
- Install the Helm CLI: Helm is a package manager for Kubernetes that allows you to deploy applications using pre-configured Helm charts. By installing the Helm CLI on your local machine, you'll be able to manage the lifecycle of applications on your GKE cluster.
- Add the Helm chart repository: Helm charts are stored in repositories. You'll need to add the repository containing the
mediawiki-dev
chart to your Helm configuration. - Deploy the Helm chart: Once the repository is added, you can deploy the
mediawiki-dev
Helm chart to your GKE cluster.
Let's begin with the Pulumi TypeScript program:
import * as gcp from "@pulumi/gcp"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Create a GKE cluster const cluster = new gcp.container.Cluster("mediawiki-cluster", { initialNodeCount: 2, minMasterVersion: "latest", // Specify the version or use "latest" for the latest stable version nodeVersion: "latest", nodeConfig: { machineType: "e2-standard-2", // Machine type to use for nodes oauthScopes: [ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring" ], }, }); // Export the Cluster name export const clusterName = cluster.name; // Obtain the Kubeconfig for the GKE cluster const kubeconfig = pulumi. all([cluster.name, cluster.endpoint, cluster.masterAuth]). apply(([name, endpoint, masterAuth]) => { const context = `${gcp.config.project}_${gcp.config.zone}_${name}`; return `apiVersion: v1 clusters: - cluster: certificate-authority-data: ${masterAuth.clusterCaCertificate} server: https://${endpoint} name: ${context} contexts: - context: cluster: ${context} user: ${context} name: ${context} current-context: ${context} kind: Config preferences: {} users: - name: ${context} user: auth-provider: config: cmd-args: config config-helper --format=json cmd-path: gcloud expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp `; }); // Create a Kubernetes Provider instance with the kubeconfig const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: kubeconfig, }); // Define the Helm Release for mediawiki using the chart from 'bitnami' repository const mediawikiRelease = new k8s.helm.v3.Release("mediawiki-release", { chart: "mediawiki", version: "10.3.2", // Specify the chart version repositoryOpts: { repo: "https://charts.bitnami.com/bitnami", }, values: { mariadb: { enabled: true, }, }, }, { provider: k8sProvider }); // Export the Mediawiki release status export const mediawikiStatus = mediawikiRelease.status;
In this program:
-
GKE Cluster: We create a new GKE cluster with a specified node count and machine type. You may adjust these settings as needed for the workload you anticipate for running Mediawiki.
-
Kubeconfig: This is the configuration required for the Kubernetes provider to interact with your GKE cluster.
pulumi.all
is used here to wait for all outputs that are needed to compute the kubeconfig. -
Kubernetes Provider: The Kubernetes provider is instantiated using the kubeconfig of the GKE cluster, which is the provider that Helm will use to deploy resources to your cluster.
-
Helm Release: A Helm release for the
mediawiki
chart is defined, specifying the chart version and additional configurations. The chart is sourced from the Bitnami Helm repository.It's important to note that you need to specify values for the Helm chart that correspond to your desired configuration for Mediawiki and its components, such as MariaDB in this example. The Bitnami repository is known for maintaining well-documented and up-to-date Helm charts, including for Mediawiki.
-
Outputs: We export the name of the GKE cluster and the status of the Mediawiki Helm release. When you run
pulumi up
, these outputs will be displayed in your terminal.
After writing the Pulumi program, you would typically run
pulumi up
to apply the configuration and deploy your application. This will set up the GKE cluster and deploy Mediawiki using Helm within that cluster. Keep in mind that this is a simplified example, and additional configurations might be necessary for a production setup.