Deploy the atlassian-confluence helm chart on Azure Kubernetes Service (AKS)
TypeScriptDeploying an Atlassian Confluence instance via a Helm chart on Azure Kubernetes Service (AKS) is a multi-step process. Here is an overview of how to accomplish this using Pulumi with TypeScript:
-
Create an AKS cluster: We'll first need to provision an Azure Kubernetes Service cluster where our Confluence instance will run. This requires specifying the size and number of nodes, along with other configuration details.
-
Install the Helm Chart: After setting up the AKS cluster, we'll deploy Atlassian Confluence using its associated Helm chart. Pulumi provides a resource to manage Helm charts, which we'll utilize to install Confluence.
-
Expose Confluence: Typically, Confluence would be exposed via a Kubernetes service of type LoadBalancer or via an Ingress controller. This step would ensure that you can access the Confluence web interface externally.
Let's begin by writing a Pulumi program in TypeScript:
import * as pulumi from "@pulumi/pulumi"; import * as azure from "@pulumi/azure"; import * as k8s from "@pulumi/kubernetes"; import * as azuread from "@pulumi/azuread"; import * as azure_native from "@pulumi/azure-native"; import * as random from "@pulumi/random"; // Step 1: Create an AKS cluster const resourceGroupName = new azure_native.resources.ResourceGroup("aksResourceGroup", { location: "eastus", // You can choose the Azure region that is close to your location }); const adApp = new azuread.Application("confluenceApp", {}); const adSp = new azuread.ServicePrincipal("confluenceSp", { applicationId: adApp.applicationId, }); const password = new random.RandomPassword("confluencePassword", { length: 20, special: true, }); const adSpPassword = new azuread.ServicePrincipalPassword("confluenceSpPassword", { servicePrincipalId: adSp.id, value: password.result, endDate: "2099-01-01T00:00:00Z", }); const k8sCluster = new azure.containerservice.KubernetesCluster("confluenceCluster", { resourceGroupName: resourceGroupName.name, defaultNodePool: { name: "aksagentpool", nodeCount: 2, // Change the count as needed vmSize: "Standard_DS2_v2", // Change the size as required }, dnsPrefix: `${pulumi.getStack()}-kube`, linuxProfile: { adminUsername: "aksuser", sshKey: { keyData: "<YOUR_SSH_PUBLIC_KEY>", // Replace with your SSH public key }, }, servicePrincipal: { clientId: adApp.applicationId, clientSecret: adSpPassword.value, }, }); // Export the Kubeconfig export const kubeconfig = pulumi .all([k8sCluster.name, resourceGroupName.name]) .apply(([clusterName, rgName]) => { return azure.containerservice.getKubeConfig({ name: clusterName, resourceGroupName: rgName, }); }); // Step 2: Deploy Atlassian Confluence using Helm Chart const confluenceChart = new k8s.helm.v3.Chart("confluenceChart", { chart: "confluence", version: "X.Y.Z", // Specify the version of the chart you wish to deploy fetchOpts: { repo: "https://atlassian.github.io/data-center-helm-charts/", // This is the repository containing the Confluence chart }, // Add any custom values for the Helm chart deployment values: { confluence: { replicaCount: 1, // Change based on desired replica count // Any other required confluence values can go here }, // Other subchart values (e.g., PostgreSQL) can be specified here }, }, { provider: new k8s.Provider("k8s", { kubeconfig: kubeconfig }) }); // Expose Confluence // You can further implement exposing Confluence via a K8s service or ingress here
Now, let's discuss each step in detail:
-
Creating the AKS Cluster: We create a new resource group, a new application in Azure AD for our AKS cluster, and a service principal that the AKS cluster uses. We also generate a random password for the service principal. You need to replace
<YOUR_SSH_PUBLIC_KEY>
with an SSH public key that can be used for accessing the nodes in the cluster. -
Deploying Confluence using Helm: We're using the
k8s.helm.v3.Chart
resource to deploy the Confluence Helm chart from Atlassian's official repository. You'll need to replaceX.Y.Z
with the version number of the chart you wish to use. We set custom values for the chart through thevalues
property. -
Exposing Confluence: In typical scenarios, after deploying Confluence, you would need to expose it to be accessible. This snippet does not include this step because it's highly dependent on your specific requirements, such as whether you want to use an Ingress controller, which type of Ingress, usage of TLS certificates, etc.
Please note that you would need to perform
pulumi up
to deploy these resources to Azure. This will establish the necessary infrastructure and deploy Atlassian Confluence as specified.Remember to replace placeholders like
<YOUR_SSH_PUBLIC_KEY>
with your actual SSH key and the chart version with the specific version number. You may also want to refine the configuration by setting environment-specific values or by adjusting the Helm chart deployment to align with your Confluence configuration requirements.-