Deploy the ibm-mqadvanced-server-dev helm chart on Google Kubernetes Engine (GKE)
TypeScriptDeploying an IBM MQ Advanced Server Developer edition helm chart on Google Kubernetes Engine (GKE) involves several steps:
-
Set up GKE Cluster: We need a running Kubernetes cluster on GKE to deploy our helm chart. This will be our deployment environment.
-
Enable Kubernetes API: Ensure that the Kubernetes Engine API is enabled for your Google Cloud project.
-
Configure Helm and Tiller: Helm is a package manager for Kubernetes. You'll install Helm on your machine and configure Tiller (the server-side component of Helm) to interact with your GKE cluster.
-
Find and Install Helm Chart: You will need to locate the helm chart for
ibm-mqadvanced-server-dev
, add the repository containing the chart, and then install it to your cluster using Helm Commands. -
Verify Deployment: After deploying the helm chart, you should verify that the services are running correctly within your GKE cluster.
Below is a Pulumi program in TypeScript, which outlines the steps to programmatically create a GKE cluster and deploy
ibm-mqadvanced-server-dev
using the Helm package from a public chart repository. This code assumes you have Pulumi andgcloud
CLI installed and configured with the prerequisites for GKE and Helm.Please ensure you have Pulumi's GCP package installed and Helm package for Pulumi.
import * as gcp from "@pulumi/gcp"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Step 1: Creating a GKE cluster const cluster = new gcp.container.Cluster("my-gke-cluster", { initialNodeCount: 1, minMasterVersion: "latest", nodeVersion: "latest", nodeConfig: { machineType: "n1-standard-1", oauthScopes: [ // Scopes for proper API access for the nodes "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", ], }, }); // Obtain the cluster kubeconfig that will be used by Helm 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 `; }); // Step 2: Set up a Kubernetes provider instance using the kubeconfig above const k8sProvider = new k8s.Provider("gkeK8s", { kubeconfig: kubeconfig, }); // Step 3: Deploy the ibm-mqadvanced-server-dev helm chart using the // Kubernetes Helm Chart resource const chart = new k8s.helm.v3.Chart("ibm-mq-chart", { chart: "ibm-mqadvanced-server-dev", fetchOpts:{ repo: "https://raw.githubusercontent.com/ibm-messaging/mq-helm/master/repo/stable/", }, }, { provider: k8sProvider }); // Export the Cluster name and the Kubeconfig to access the cluster with kubectl export const clusterName = cluster.name; export const KubeConfig = kubeconfig;
Explanation:
- We start by declaring a new GKE cluster using
@pulumi/gcp
. We configure the node count, machine type, and necessary API scopes for the nodes. - A kubeconfig is generated for our newly created cluster. This config lets Pulumi (and any Kubernetes tooling like
kubectl
) communicate with your cluster. - We then instantiate a new Pulumi Kubernetes provider,
k8s.Provider
, which is configured with the kubeconfig. - The
k8s.helm.v3.Chart
resource is used to deploy theibm-mqadvanced-server-dev
Helm chart to the cluster. Pulumi's Helm Chart resource will interact with the Helm CLI to perform the deployment. Adjust thefetchOpts.repo
to match the repository containing the chart. - Finally, we export the cluster name and kubeconfig. They can be used to access the GKE cluster using
kubectl
if necessary.
This program will create the GKE cluster and deploy IBM MQ to it. Make sure to run
pulumi up
to create and deploy the resources. After the deployment, verify that all services are running as expected withkubectl get pods --kubeconfig=<exported_kubeconfig_file>
.-