Deploy the atlassian-jira helm chart on Google Kubernetes Engine (GKE)
TypeScriptTo deploy the Atlassian JIRA Helm chart on Google Kubernetes Engine (GKE), we'll use Pulumi's
kubernetes
andgcp
packages. The process involves several discrete steps:- Create a GKE cluster: We'll deploy a GKE cluster, which is a managed Kubernetes service provided by Google Cloud, to run our JIRA pods.
- Configure kubectl: Once the cluster is up, we configure
kubectl
to communicate with it by fetching the kubeconfig for the cluster. - Deploy the Helm chart: With kubectl configured, we can proceed to deploy the JIRA Helm chart to the cluster.
Below is the Pulumi program that performs these steps. The program is written in TypeScript and is designed to be comprehensive for a novice user.
First, let's define the GKE cluster:
import * as pulumi from "@pulumi/pulumi"; import * as gcp from "@pulumi/gcp"; import * as k8s from "@pulumi/kubernetes"; // Create a GKE cluster const cluster = new gcp.container.Cluster("jira-cluster", { initialNodeCount: 2, nodeVersion: "latest", minMasterVersion: "latest", nodeConfig: { machineType: "n1-standard-1", // or any other preferred machine type 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", ], }, });
After the cluster is created, we obtain the kubeconfig. This tells
kubectl
how to communicate with the cluster:// Output the kubeconfig for the 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 `; });
With our kubeconfig in place, we can now deploy the Atlassian JIRA Helm chart. For this, we use Pulumi's Kubernetes provider. The Helm chart is released by Atlassian and should be available in the Helm repositories. The code assumes that the chart is available in a Helm repo that has been added with the name
atlassian
.// Create a Kubernetes provider instance using the kubeconfig const provider = new k8s.Provider("gke-k8s", { kubeconfig }); // Deploy the Atlassian JIRA Helm chart const jiraChart = new k8s.helm.v3.Chart("jira", { chart: "jira-software", version: "VERSION", // Specify the chart version you wish to deploy fetchOpts:{ repo: "https://atlassian.github.io/data-center-helm-charts", // Atlassian Helm charts repository }, // Helm chart values can be set here if necessary, for example: values: { // Reference the specific values for the JIRA chart you wish to set }, }, { provider });
Finally, we export the Kubernetes cluster name and the chart name so that we can easily reference them later:
// Export the Cluster name and Chart name export const clusterName = cluster.name; export const jiraChartName = jiraChart.releaseName;
To run this Pulumi program, you'd create a new TypeScript Pulumi project, place the above code in your
index.ts
file, and then execute it using the following Pulumi CLI commands:pulumi up
Pulumi will show you a preview of the resources that will be created. Once you confirm that everything looks good, Pulumi will provision the resources in the order specified. After it's complete, you will have a GKE cluster running Atlassian JIRA seeded from the Helm chart.