Deploy the seq helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy the Seq Helm chart on an Azure Kubernetes Service (AKS) cluster, we'll go through the following steps:
-
Set up an AKS cluster: Create a resource group and an AKS cluster within that group, ensuring you have the necessary compute resources and configurations like the desired Kubernetes version and node size.
-
Deploy Seq using Helm: Helm is a package manager for Kubernetes, and we will use it to deploy Seq (log management system) via its Helm Chart. This involves configuring the chart values to suit our deployment needs.
Let's start with setting up the AKS cluster. Here we will use the
azure-native
provider which is Pulumi's native Azure provider built on top of the Azure Resource Manager (ARM) definitions.Step 1: Set up the Azure Kubernetes Service (AKS) cluster
import * as pulumi from "@pulumi/pulumi"; import * as azure from "@pulumi/azure"; import * as azuread from "@pulumi/azuread"; import * as k8s from "@pulumi/kubernetes"; import * as random from "@pulumi/random"; // Create a new Azure Resource Group const resourceGroup = new azure.core.ResourceGroup("myResourceGroup"); // Create an Azure AD application for AKS const aksApp = new azuread.Application("aksApp"); // Create a Service Principal for the AKS application const adSp = new azuread.ServicePrincipal("aksSp", { applicationId: aksApp.applicationId, }); // Create a random password for the Service Principal const adSpPassword = new random.RandomPassword("aksSpPassword", { length: 20, special: true, }); // Assign the password to the Service Principal const spPassword = new azuread.ServicePrincipalPassword("aksSpPassword", { servicePrincipalId: adSp.id, value: adSpPassword.result, endDate: "2099-01-01T00:00:00Z", }); // Create the AKS cluster using the azure-native provider const cluster = new azure.containerservice.KubernetesCluster("aksCluster", { resourceGroupName: resourceGroup.name, defaultNodePool: { name: "default", nodeCount: 2, vmSize: "Standard_D2_v2", }, dnsPrefix: `${pulumi.getStack()}-kube`, linuxProfile: { adminUsername: "adminuser", sshKey: { keyData: sshPublicKey, }, }, servicePrincipal: { clientId: aksApp.applicationId, clientSecret: spPassword.value, }, kubernetesVersion: "1.19.11", }); // Export the kubeconfig export const kubeconfig = cluster.kubeConfigRaw;
In this code, we created a new resource group, an Azure Active Directory (AAD) application, service principal, and then an AKS cluster. We also set up a default node pool for the cluster and defined a Linux profile for SSH access to the nodes. Note that you will need to provide your own SSH public key in place of
sshPublicKey
.Step 2: Deploy Seq using Helm
Now that we have an AKS cluster set up, we can deploy Seq onto our cluster. We'll use the Pulumi Kubernetes package
@pulumi/kubernetes
to accomplish this.// Create a Kubernetes provider instance that uses our kubeconfig const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: kubeconfig, }); // Deploy Seq using the Helm Chart. const seqRelease = new k8s.helm.v3.Chart("seq", { chart: "seq", version: "2021.2.5641", // Replace with the specific version you need fetchOpts:{ repo: "https://helm.datalust.co", // The Helm repository URL where the chart is located }, }, { provider: k8sProvider }); // Export the Seq endpoint to access it externally export const seqEndpoint = seqRelease.getResourceProperty("v1/Service", "seq-seq", "status").apply(status => status.loadBalancer.ingress[0].ip);
In this code block, we define a Helm chart resource that points to the Seq Helm chart's repository and version we want to deploy. We also export an endpoint that you can use to access the Seq service externally.
Note: Version numbers here are examples and should be the actual versions you want to use. Helm charts often expose additional configuration options, which you can specify within the
values
property ofhelm.v3.Chart
.It's important to replace
2021.2.5641
with the specific version of the Seq Helm chart that you want to install, and to verify the repository URL for Seq's Helm chart if it has changed.Once these resources have been declared, you can deploy your Pulumi stack with
pulumi up
. After the deployment is complete, the Seq endpoint will be printed to the console. You can then use this endpoint to access your Seq dashboard.-