Deploy the instana-agent-operator helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy the Instana Agent Operator Helm chart on an Azure Kubernetes Service (AKS) cluster, you need to complete a few steps:
- Create or configure an existing AKS cluster: Ensure you have access to an AKS cluster where you can deploy applications.
- Install Pulumi: Pulumi is an infrastructure-as-code tool that allows you to define and manage your infrastructure with code written in programming languages like TypeScript.
- Write a Pulumi program: This program will use the Pulumi Kubernetes provider to deploy the Helm chart to the AKS cluster.
- Run the Pulumi CLI: Apply your Pulumi program to deploy the Helm chart to the AKS cluster.
Below is a Pulumi program written in TypeScript that you can use to deploy the Instana Agent Operator Helm chart on an AKS cluster. This program assumes that you have already set up Pulumi and have configured the Azure provider with the necessary credentials. It also assumes you have created an AKS cluster and have the necessary
kubeconfig
file to interact with it.Here's a step-by-step walk-through of the program:
Importing the Pulumi Packages
We begin by importing the Pulumi Kubernetes package, which allows us to interact with Kubernetes resources:
import * as k8s from "@pulumi/kubernetes";
Deploying the Helm Chart
Next, we use the
Chart
class from the@pulumi/kubernetes/helm/v3
module to deploy the Instana Agent Operator Helm chart. TheChart
resource lets us deploy a Helm chart from a repository by specifying the name of the chart and other optional parameters such as the chart version, values to override default configurations, and the Kubernetes namespace into which the chart should be deployed.The Pulumi Program
Now, let's write the full Pulumi program to achieve this.
import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Retrieve the kubeconfig for the AKS cluster. // This can be sourced from a Pulumi stack export, if you're managing AKS cluster with Pulumi. // For example: const kubeconfig = pulumi.output(aksStack.getOutput("kubeconfig")); // Alternatively, if the kubeconfig is saved locally, you can import it from a file. // Ensure that the kubeconfig does not get checked into source control. const kubeconfig = pulumi.output("<YOUR_AKS_CLUSTER_KUBECONFIG>"); // Create a provider instance using the kubeconfig from above, // which specifies the AKS cluster where resources should be deployed. const provider = new k8s.Provider("aks-provider", { kubeconfig: kubeconfig, }); // Define the Helm chart for the Instana Agent Operator. // Replace `chartVersion` with the desired version of the Instana Agent Operator chart. const instanaAgentOperator = new k8s.helm.v3.Chart("instana-agent-operator", { chart: "instana-agent-operator", version: "<CHART_VERSION>", // specify the chart version fetchOpts: { repo: "https://helm.instana.io", // Instana Helm repository }, }, { provider: provider }); // Export any necessary information, such as the Helm release name. export const helmReleaseName = instanaAgentOperator.releaseName;
Running the Program
To run this program:
- Save it to a file, for example
index.ts
. - Run
pulumi up
in the command line within the same directory where the file is saved.
This command initializes the Pulumi deployment, previews the changes to the infrastructure, and applies the changes. The output will include any exports we have defined in the program, such as
helmReleaseName
.You'll then see that the Helm chart is deployed onto your AKS cluster, and you can use
kubectl
or the Azure Portal to see the Instana Agent Operator running.Notes
- Be sure to replace
<YOUR_AKS_CLUSTER_KUBECONFIG>
with your actual AKS cluster kubeconfig and<CHART_VERSION>
with the version of the Instana Agent Operator Helm chart you wish to deploy. - The provided program does not validate your AKS credentials or the existence of an Instana Helm chart version. Make sure you have access to the AKS cluster and that the specified Helm chart version exists in the Instana Helm repository before running the program.
- The kubeconfig should be treated securely and should not be exposed or hard-coded in your Pulumi program. It's best to use Pulumi stack references or configuration secrets for handling such sensitive information.