Deploy the kubernetes-dashboard-gateway helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy the Kubernetes Dashboard Gateway Helm Chart on Azure Kubernetes Service (AKS), we will follow these steps:
- Provision an AKS cluster using the
azure-native.containerservice.ManagedCluster
resource. - Deploy the Helm chart on the provisioned AKS cluster using the
kubernetes.helm.v3.Chart
resource.
The
azure-native.containerservice.ManagedCluster
is used to create and manage an AKS cluster in Azure. This is the foundational resource that provides a Kubernetes cluster in the Azure cloud environment.The
kubernetes.helm.v3.Chart
resource is part of the Kubernetes provider for Pulumi and allows us to deploy Helm charts to a Kubernetes cluster. Helm is a package manager for Kubernetes, and using Helm charts eases the deployment and management of Kubernetes applications.Here's a TypeScript program that accomplishes these tasks:
import * as azureNative from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Create an AKS cluster. const managedCluster = new azureNative.containerservice.ManagedCluster("myAksCluster", { resourceGroupName: "myResourceGroup", // Other necessary AKS configuration goes here // Refer to the documentation for additional options // Documentation: https://www.pulumi.com/registry/packages/azure-native/api-docs/containerservice/managedcluster/ }); // Using the kubeconfig from generated AKS, create a Kubernetes provider instance. const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: managedCluster.kubeConfigRaw, }); // Deploy the kubernetes-dashboard Helm chart using the Kubernetes provider. const dashboardChart = new k8s.helm.v3.Chart("kubernetes-dashboard", { chart: "kubernetes-dashboard", version: "5.0.0", // You should specify the version of the chart namespace: "kube-system", // Deploy this chart in the 'kube-system' namespace or any other if needed fetchOpts: { repo: "https://kubernetes.github.io/dashboard/", // Helm repository URL where the chart is located }, }, { provider: k8sProvider }); // Export the Kubernetes Dashboard IP to access it externally. export const dashboardIp = dashboardChart.getResourceProperty("v1/Service", "kube-system/kubernetes-dashboard", "status") .apply(status => status.loadBalancer.ingress[0].ip); // When the program is executed, it will print out the external IP address of the Kubernetes Dashboard.
This program sets up the AKS cluster and then deploys the Kubernetes Dashboard Helm chart to the cluster. We also export the external IP of the Dashboard so it can be accessed once available.
Here's a brief explanation of key parts of the program:
- The
ManagedCluster
resource requires a resource group name and other AKS configuration parameters based on your requirements, such as node size, count, and other specific AKS settings. - The Kubernetes provider instance is created with the
kubeconfig
obtained from the AKS cluster, allowing Pulumi to interact with your AKS cluster. - The
Chart
resource deploys the Kubernetes Dashboard using the specified chart version and Helm repository. You should adjust the version number to the release you wish to install and confirm the repository URL. - The
dashboardIp
is an exported variable that contains the external IP address under which the Kubernetes Dashboard can be accessed once it's been assigned by the load balancer.
You will need to replace
"myResourceGroup"
with the name of your Azure resource group and provide relevant AKS configurations. Ensure you have the necessary permissions and that your Pulumi stack is correctly configured for your Azure account.After running this Pulumi program (using
pulumi up
in your terminal), you should see outputs that include the IP address you can use to access the Kubernetes Dashboard.- Provision an AKS cluster using the