Deploy the redis-persistent helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the
redis-persistent
Helm chart on Azure Managed OpenShift Service, we will perform the following steps:- Set up an Azure Managed OpenShift (ARO) Cluster.
- Use the Helm chart resource to deploy the
redis-persistent
Helm chart onto the ARO cluster.
We will use two main Pulumi resources:
-
azure-native.containerservice.OpenShiftManagedCluster
from theazure-native
package, which allows us to create and manage an Azure Red Hat OpenShift cluster. Documentation for OpenShiftManagedCluster. -
kubernetes.helm.v3.Chart
from thekubernetes
package, which allows us to deploy a Helm chart on a Kubernetes cluster. Documentation for Helm Chart.
First, we'll create a new Azure Red Hat OpenShift cluster. This will be a managed Kubernetes service that supports OpenShift features on Azure.
Next, once we have the cluster ready, we'll configure the Pulumi Kubernetes provider to target the new ARO cluster. This involves using the
kubeconfig
received from the ARO cluster creation to establish connectivity.Finally, we'll deploy the
redis-persistent
Helm chart to the ARO cluster using thekubernetes.helm.v3.Chart
resource. This will create all the necessary Kubernetes resources as defined in the Helm chart for Redis with persistent storage on the ARO cluster.Below is a TypeScript program you can use to accomplish this task:
import * as pulumi from "@pulumi/pulumi"; import * as azure from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Set up an Azure Managed OpenShift Cluster const resourceGroupName = new azure.resources.ResourceGroup("aroResourceGroup"); const openShiftCluster = new azure.containerservice.OpenShiftManagedCluster("aroCluster", { resourceName: "myAROCluster", resourceGroupName: resourceGroupName.name, location: resourceGroupName.location, openShiftVersion: "4.3", // Specify the OpenShift version // Define other necessary cluster configuration properties such as network, master/agent profiles }); // Step 2: Deploy the redis-persistent Helm chart onto the ARO cluster // Create a k8s provider instance using the kubeconfig from the ARO cluster const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: openShiftCluster.config.kubeconfig.apply(JSON.stringify) }); const redisChart = new k8s.helm.v3.Chart("redis-persistent", { chart: "redis", // This should be the name of the chart; check the exact name in the helm repository // Typically, you should specify the repository using `repo` field, if it's different from the stable repository values: { // Specify any values needed for the `redis-persistent` Chart // e.g., to request persistent volumes on Azure, you might specify a storage class or related configuration }, }, { provider: k8sProvider }); // Export the URL for the redis service export const redisServiceUrl = pulumi.interpolate `http://${redisChart.getResourceProperty("v1/Service", "redis-master-svc", "status")?.loadBalancer?.ingress[0]?.ip}`;
In this program, we're creating a new managed OpenShift cluster and deploying the Helm chart for Redis to it. The
azure-native.containerservice.OpenShiftManagedCluster
resource is responsible for setting up the cluster with the desired configurations, and thek8s.helm.v3.Chart
resource from thekubernetes
package is used to deploy theredis-persistent
chart. Please ensure that you replace"redis"
with the specific name of the chart if it differs in the repository where you're fetching it from.Finally, we're exporting the service URL for Redis, which can be used to connect to the Redis instance once it’s up and running.
Make sure you have the necessary Azure and Kubernetes CLI tools installed and configured on your machine to run this Pulumi program, and you have access to an Azure subscription. You might need to adjust the version and other parameters of the OpenShift cluster and the Helm chart values according to your needs.