Deploy the rabbitmq-observability helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the rabbitmq-observability Helm chart on Azure Managed OpenShift Service using Pulumi, you'll need to perform the following steps:
-
Set up an Azure Managed OpenShift Cluster: An OpenShift Managed Cluster provides a Kubernetes platform based on OpenShift, which is managed by Microsoft Azure.
-
Install the RabbitMQ Helm Chart: With a running OpenShift cluster, you can use the Pulumi Kubernetes package to deploy Helm charts.
Before you get started with the Pulumi code, make sure you have the following prerequisites in place:
- Azure Account: Access to an Azure subscription where you can deploy resources.
- Pulumi Account: Sign up for a Pulumi account and install the Pulumi CLI on your machine.
- Azure Service Principal: Set up an Azure Service Principal with the required permissions and configure Pulumi to use it for creating resources in your Azure subscription.
- Kubectl: This is necessary for interacting with the Kubernetes cluster.
- OpenShift CLI (oc): The OpenShift CLI is helpful when you need to interact directly with the OpenShift cluster.
Below is a TypeScript program that demonstrates how to accomplish this:
import * as azure_native from "@pulumi/azure-native"; import * as kubernetes from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Step 1: Set up the Azure Managed OpenShift Cluster // The following code declares a new Azure OpenShift Managed cluster. // Replace these with appropriate values const resourceGroupName = 'myResourceGroup'; const clusterName = 'myOpenShiftCluster'; const location = 'EastUS'; // Choose a supported Azure region for OpenShift const openshiftCluster = new azure_native.containerservice.OpenShiftManagedCluster(clusterName, { // Required properties resourceGroupName: resourceGroupName, resourceName: clusterName, location: location, // Define the OpenShift version openShiftVersion: "4.3", // Use a supported version // Define the network profile networkProfile: { vnetCidr: "10.0.0.0/8", }, // Define the master and worker node pools masterPoolProfile: { name: "master", count: 3, vmSize: "Standard_D4s_v3", }, agentPoolProfiles: [{ name: "worker", count: 3, vmSize: "Standard_D4s_v3", }], }); // Step 2: Install the RabbitMQ Helm Chart using the Kubernetes provider for Pulumi // Once the cluster is available, configure the Kubernetes provider to connect to the OpenShift cluster. const k8sProvider = new kubernetes.Provider("k8sProvider", { // Use the kubeconfig from the created OpenShift cluster kubeconfig: openshiftCluster.kubeConfigRaw, }); // Deploy the rabbitmq-observability Helm chart const rabbitMqChart = new kubernetes.helm.v3.Chart("rabbitmq-observability", { chart: "rabbitmq-observability", // The repo option allows you to specify the Helm chart repository fetchOpts: { repo: "https://charts.bitnami.com/bitnami", // Replace with the actual repository if different }, // Additional options can be provided based on the rabbitmq-observability chart's values // For example: // values: { // replicaCount: 3, // persistence: { // enabled: true, // size: "10Gi" // } // }, }, { provider: k8sProvider }); export const kubeConfig = openshiftCluster.kubeConfigRaw;
- The code starts by defining an Azure Managed OpenShift Cluster in the specified resource group and location. Adjust the
resourceGroupName
,clusterName
, andlocation
variables to match your environment. - We have chosen a simple setup for the OpenShift Cluster Network Profile with a basic VNet CIDR.
- Agent pool profiles are also defined for worker nodes. Here, replace
"Standard_D4s_v3"
with the appropriate VM size that suits your workload. - The status of the cluster after creation could be monitored, and once available, a Kubernetes provider is initialized with the kubeconfig of the created OpenShift cluster.
- We then declare a new Helm chart resource for
rabbitmq-observability
which is going to deploy the RabbitMQ application onto our Kubernetes cluster. Modify therepo
underfetchOpts
to point to the correct Helm repository if it's different from the provided example. - The
values
option can be customized based on the specific settings you want for RabbitMQ. - After executing the Pulumi program, ensure that you perform
pulumi up
to deploy the resources onto Azure.
Make sure to check the RabbitMQ Helm chart's documentation for the correct chart name and any specific values you need to override for your particular deployment.
For more in-depth reading about the resources used:
- For OpenShift Managed Clusters: OpenShiftManagedCluster
- For Helm Chart deployments: Chart
Once your infrastructure is successfully deployed, you can use
kubectl
or OpenShift CLIoc
commands to interact with your cluster and verify the deployment of RabbitMQ.-