Deploy the linkerd-edge-mixin helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy the
linkerd-edge-mixin
Helm chart on an Azure Kubernetes Service (AKS) cluster using Pulumi, we will follow these steps:-
Set up an AKS cluster: Before deploying any applications, you need an AKS cluster. An AKS cluster gives you a managed Kubernetes cluster in Azure that you don't need to maintain or update manually. You can provision an AKS cluster using Pulumi's
azure-native.containerservice.ManagedCluster
resource. -
Deploy the Helm chart: With the cluster set up, you can deploy Helm charts to the cluster. Pulumi provides the
kubernetes.helm.v3.Chart
resource to streamline this process. You will need to point to the Helm repository that hosts yourlinkerd-edge-mixin
chart and specify any configuration values required by the chart.
Below is a TypeScript program that accomplishes these tasks. This program assumes you have already configured Pulumi with your Azure credentials.
import * as azure from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Step 1: Create an AKS cluster const resourceGroup = new azure.resources.ResourceGroup("myResourceGroup"); const cluster = new azure.containerservice.ManagedCluster("myAksCluster", { resourceGroupName: resourceGroup.name, // Required properties (like location) are typically specified in the config, // but you can hardcode them as well in the code. location: resourceGroup.location, agentPoolProfiles: [{ count: 1, vmSize: "Standard_B2s", name: "agentpool" // Name for the node pool }], dnsPrefix: "myakscluster" // Replace with a prefix you prefer or generate a unique one }); // Export the kubeconfig for the cluster export const kubeconfig = pulumi. all([cluster.name, resourceGroup.name]). apply(([clusterName, resourceGroupName]) => { return azure.containerservice.listManagedClusterUserCredentials({ resourceGroupName: resourceGroupName, resourceName: clusterName, }); }). apply(creds => Buffer.from(creds.kubeconfigs[0].value, "base64").toString()); const k8sProvider = new k8s.Provider("k8s", { kubeconfig }); // Step 2: Deploy the linkerd-edge-mixin Helm chart const linkerdChart = new k8s.helm.v3.Chart("linkerd-edge-mixin", { chart: "linkerd-edge-mixin", version: "latest", // Specify the version, or use "latest" if you want the latest version fetchOpts: { repo: "https://helm.linkerd.io/edge", // URL of the linkerd-edge Helm repository }, }, { provider: k8sProvider }); // Export the endpoint of the AKS cluster export const aksClusterEndpoint = cluster.privateFqdn;
This program will do the following:
- Create a new resource group in Azure to host all our resources.
- Provision a new AKS cluster inside this resource group. We've specified a single node pool with one node for simplicity.
- Note other required properties such as
location
anddnsPrefix
are either specified directly or can be provided through Pulumi config. For a production-grade cluster, you'll likely need additional configurations (like multiple node pools, network policies, etc.).
- Note other required properties such as
- Retrieve and export the
kubeconfig
file, allowing you to interact with the cluster usingkubectl
or other Kubernetes tools. - Initialize a Pulumi Kubernetes provider using the
kubeconfig
. - Deploy the
linkerd-edge-mixin
Helm chart to the AKS cluster using the Kubernetes provider.
Remember to replace some of the values (e.g.,
dnsPrefix
) with your own preferred values or auto-generate them as necessary. Additionally, if the Helm chartlinkerd-edge-mixin
requires it, you can supply custom configuration values within thevalues
field of theChart
resource.After running
pulumi up
to apply this Pulumi program, the infrastructure will be set up, and thelinkerd-edge-mixin
chart will be deployed to your AKS cluster. You can manage and monitor your Kubernetes resources through the Azure portal or using Kubernetes tooling likekubectl
.-