Deploy the krakend helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy the KrakenD Helm chart on Azure Kubernetes Service (AKS), you will need to:
- Set up an AKS cluster.
- Install and configure Helm.
- Deploy the KrakenD Helm chart to your AKS cluster.
The following Pulumi program in TypeScript will guide you through these steps:
Program Explanation:
- We start by importing the necessary Pulumi and Azure SDK packages.
- Next, we create an AKS cluster using the
ManagedCluster
class from the Azure Native provider. We specify the required configurations such as node count, VM size, and others. - Once the cluster is set up, we obtain the necessary kubeconfig to interact with the cluster.
- We then use the
Chart
class from the Pulumi Kubernetes provider to deploy the KrakenD Helm chart. By specifying the chart name, version, and any custom values we wish to apply to our Helm chart.
Here is the Pulumi TypeScript program that accomplishes the above steps:
import * as pulumi from "@pulumi/pulumi"; import * as azure_native from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Create an AKS cluster const resourceGroup = new azure_native.resources.ResourceGroup("myResourceGroup"); const aksCluster = new azure_native.containerservice.ManagedCluster("myAKSCluster", { resourceGroupName: resourceGroup.name, agentPoolProfiles: [{ count: 3, vmSize: "Standard_DS2_v2", name: "agentpool", }], dnsPrefix: "myakscluster", enableRBAC: true }); // Export the kubeconfig for the cluster export const kubeconfig = aksCluster.kubeConfig; // Create a Kubernetes provider instance using the kubeconfig const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: aksCluster.kubeConfig, }); // Deploy KrakenD Helm chart using the Kubernetes provider const krakendChart = new k8s.helm.v3.Chart("krakend", { chart: "krakend", version: "1.0.0", // Specify the chart version you want to deploy fetchOpts: { repo: "https://helm-charts.krakend.io", // The Helm chart repository URL }, }, { provider: k8sProvider }); // Export the KrakenD service endpoint export const krakendEndpoint = krakendChart.getResourceProperty("v1/Service", "krakend-krakend", "status").apply(status => `http://${status.loadBalancer.ingress[0].ip}`);
What the program does:
ResourceGroup
defines a resource group where all resources will reside in Azure.ManagedCluster
creates a new AKS cluster in the specified resource group.- By exporting
kubeconfig
, we gain access to the cluster using kubectl or other Kubernetes tools. - The
Provider
class from@pulumi/kubernetes
allows Pulumi to communicate with the newly created AKS cluster. Chart
is used to deploy the Helm chart into our AKS cluster. It references thekrakend
Helm chart from the specified repository.- Finally, we export
krakendEndpoint
, which contains the load balancer ingress IP to access the KrakenD API Gateway once it's deployed.
After running the program with
pulumi up
, you will get thekubeconfig
andkrakendEndpoint
in the output, which can be used to access your AKS cluster and the KrakenD service, respectively.