Deploy the penpot helm chart on Azure Kubernetes Service (AKS)
TypeScriptDeploying the Penpot Helm Chart on AKS with Pulumi
Deploying applications on Kubernetes can be simplified using Helm charts. Helm is a package manager for Kubernetes that allows you to define, install, and upgrade even the most complex Kubernetes applications. In this guide, I'll show you how to deploy the Penpot Helm chart on Azure Kubernetes Service (AKS) using Pulumi's TypeScript SDK.
Before we begin, let's define our objective clearly:
- We'll provision an AKS cluster on Azure.
- We'll then deploy the Penpot application using its Helm chart on the provisioned AKS cluster.
Here's an outline of the steps we will take:
- Create an Azure Resource Group.
- Provision an AKS cluster within the Azure Resource Group.
- Install the Penpot Helm chart on the AKS cluster.
We'll be using the
azure-native
provider to provision resources in Azure and thekubernetes
provider to interact with the AKS cluster and deploy Penpot.Firstly, ensure you have Pulumi installed and configured with Azure credentials, and you have
kubectl
configured to interact with your AKS cluster.Now let's start programming our deployment. Our program will be written in TypeScript, and you will need to have Node.js installed to run this code.
import * as pulumi from "@pulumi/pulumi"; import * as azure_native from "@pulumi/azure-native"; import * as kubernetes from "@pulumi/kubernetes"; // Step 1: Create an Azure Resource Group const resourceGroup = new azure_native.resources.ResourceGroup("penpotResourceGroup", { resourceGroupName: "penpot-resources", location: "West Europe", }); // Step 2: Provision an AKS cluster within the Azure Resource Group const aksCluster = new azure_native.containerservice.ManagedCluster("penpotAKSCluster", { resourceGroupName: resourceGroup.name, location: resourceGroup.location, agentPoolProfiles: [{ count: 2, // Number of agents (VMs) to host k8s workloads vmSize: "Standard_DS2_v2", name: "agentpool" // Name of the agent pool }], dnsPrefix: "penpotaks", // DNS prefix for AKS kubernetesVersion: "1.20.9", // Specify your required version of Kubernetes }); // The AKS cluster provides a kubeconfig file to interact with the cluster. // We need to use this kubeconfig to create a kubernetes provider instance. const creds = pulumi.all([aksCluster.name, resourceGroup.name]).apply(([aksName, rgName]) => azure_native.containerservice.listManagedClusterUserCredentials({ resourceGroupName: rgName, resourceName: aksName, }) ); const kubeconfig = creds.kubeconfigs[0].value.apply(c => Buffer.from(c, 'base64').toString()); const provider = new kubernetes.Provider("aksK8s", { kubeconfig: kubeconfig, }); // Step 3: Install the Penpot Helm chart on the AKS cluster const chart = new kubernetes.helm.v3.Chart("penpot", { chart: "penpot", version: "1.6.0", // Specify the chart version fetchOpts: { repo: "https://helm.penpot.app/", }, }, { provider: provider }); // Export the AKS cluster's kubeconfig so that we can interact with it from kubectl export const kubeConfigExport = pulumi.secret(kubeconfig); // Output the AKS cluster name and the Kubernetes cluster's status export const clusterName = aksCluster.name; export const clusterStatus = aksCluster.provisioningState;
The code shown above does the following:
- Step 1: Specifies the Azure Resource Group under which all the resources for Penpot will be provisioned.
- Step 2: Provisions an AKS cluster with a specified DNS prefix, Kubernetes version, and VM size for the agents.
- Step 3: Deploys the Penpot application using its Helm chart from the specified chart version and repository onto our AKS cluster.
It's important to note that when creating real infrastructure, you'll want to consider additional aspects such as the security of your resources, identity management, networking setup, and so on.
Remember to run
pulumi up
from your command line within the directory of your Pulumi project to provision resources and deploy the Penpot Helm chart to AKS. The kubeconfig output can be used withkubectl
to interact with the AKS cluster (usepulumi stack output kubeConfigExport
to retrieve it). Keep in mind to replace the placeholder values with those that match your requirements.ℹ️ Documentation References:
Make sure to review the configuration details like the
vmSize
for the AKS cluster and the Helm chartversion
to match the specific requirements of your application.