Deploy the onlyoffice-ds helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy the
onlyoffice-ds
Helm chart on Azure Kubernetes Service (AKS), you will require a few steps:- Create an AKS cluster if you don't have one already.
- Install the
onlyoffice-ds
Helm chart on your AKS cluster.
In the following program, we will:
- Define an AKS cluster using the
azure.containerservice.KubernetesCluster
resource. - Install the Helm chart using the
kubernetes.helm.sh/v3.Chart
resource.
Here's a complete Pulumi program in TypeScript to accomplish these steps:
import * as azure from "@pulumi/azure"; import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; const name = "onlyoffice-aks"; // Create an Azure Resource Group const resourceGroup = new azure.core.ResourceGroup(name, { location: "East US", }); // Create an AKS cluster. const cluster = new azure.containerservice.KubernetesCluster(name, { resourceGroupName: resourceGroup.name, defaultNodePool: { name: "akspool", nodeCount: 2, vmSize: "Standard_D2_v2", }, dnsPrefix: `${pulumi.getStack()}-kube`, linuxProfile: { adminUsername: "adminuser", sshKey: { keyData: "<SSH PUBLIC KEY>", }, }, servicePrincipal: { clientId: "<SPN CLIENT ID>", clientSecret: "<SPN CLIENT SECRET>", }, // Enable network policy for Calico network plugin. networkProfile: { networkPlugin: "azure", networkPolicy: "calico", }, }); // Export the kubeconfig of the cluster export const kubeconfig = cluster.kubeConfigRaw; // Define a Kubernetes provider using the cluster's kubeconfig const k8sProvider = new k8s.Provider(name, { kubeconfig: cluster.kubeConfigRaw, }); // Deploy the onlyoffice-ds Helm chart const onlyofficeChart = new k8s.helm.v3.Chart("onlyoffice-ds", { chart: "onlyoffice-ds", version: "<CHART VERSION>", // Specify the chart version you want to deploy fetchOpts: { repo: "https://helm.onlyoffice.com/", // Add the repository of the onlyoffice Helm chart }, }, { provider: k8sProvider }); // Export the public IP of the onlyoffice service to access the OnlyOffice Document Server export const onlyofficeServicePublicIp = pulumi.all([onlyofficeChart.getResource("v1/Service", "onlyoffice-ds"), resourceGroup.name]) .apply(([service, rgName]) => { if (service.status.loadBalancer.ingress) { return service.status.loadBalancer.ingress[0].ip; } else { // Alternatively, fetch and return the public IP of the service if it's not in the loadBalancer.ingress status field. // Implement additional logic or output message here if necessary. return null; } });
Make sure to replace
<SSH PUBLIC KEY>
,<SPN CLIENT ID>
, and<SPN CLIENT SECRET>
with your actual SSH public key for the AKS nodes, and the Azure Service Principal credentials respectively.Note: The
onlyoffice-ds
chart and version are placeholders. You must specify the correct chart name and version based on the OnlyOffice Helm chart details.To run this Pulumi program:
- Create a new directory and initialize a new Pulumi TypeScript project.
- Save this code in an
index.ts
file within your project directory. - Run
pulumi up
to preview and deploy the changes.
The program will create an AKS cluster and deploy the
onlyoffice-ds
Helm chart to this cluster. You will be able to access the OnlyOffice Document Server using the public IP exported by theonlyofficeServicePublicIp
stack output.