Deploy the rtf-test-api-instance helm chart on Azure Managed Openshift Service
TypeScriptTo deploy a Helm chart on Azure Red Hat OpenShift (ARO), you'll need to complete a few high-level steps:
- Create an Azure Red Hat OpenShift cluster.
- Install and configure
kubectl
(Kubernetes command-line tool) to communicate with the ARO cluster. - Use the Helm command-line tool to deploy your Helm chart to the ARO cluster.
For the purposes of this example, I'll provide a Pulumi program in TypeScript that automates the first step of setting up an ARO cluster. Once the cluster is set up, you can connect to it using
kubectl
and deploy your Helm chart withhelm install
.Here's a Pulumi program in TypeScript that creates an ARO cluster in Azure:
import * as pulumi from "@pulumi/pulumi"; import * as azure_native from "@pulumi/azure-native"; const resourceGroupName = "myResourceGroup"; // Replace with your desired resource group name const openshiftClusterName = "myAROCluster"; // Replace with your desired OpenShift Cluster name // Create an Azure resource group const resourceGroup = new azure_native.resources.ResourceGroup(resourceGroupName); // Define the Azure Red Hat OpenShift cluster const openshiftCluster = new azure_native.redhatopenshift.OpenShiftCluster(openshiftClusterName, { location: resourceGroup.location, resourceGroupName: resourceGroupName, clusterProfile: { pullSecret: "", // You'll need to include your Red Hat pull secret here domain: "example.com", // Replace with your own domain resourceGroupId: pulumi.interpolate`/subscriptions/${azure_native.config.subscriptionId}/resourceGroups/${resourceGroupName}`, }, masterProfile: { vmSize: "Standard_D8s_v3", subnetId: pulumi.interpolate`/subscriptions/${azure_native.config.subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/masterSubnet`, // Update with your subnet ID }, networkProfile: { podCidr: "10.128.0.0/14", serviceCidr: "172.30.0.0/16", }, workerProfiles: [ { name: "worker", // Name of the worker profile count: 3, // Number of worker nodes vmSize: "Standard_D4s_v3", subnetId: pulumi.interpolate`/subscriptions/${azure_native.config.subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/workerSubnet`, // Update with your subnet ID diskSizeGB: 128, } ], apiserverProfile: { visibility: "Public", }, }); // Export the cluster's Kubernetes configuration export const kubeconfig = pulumi.secret("myKubeConfig"); // Replace with actual logic to obtain kubeconfig
What's happening in this code:
- We've imported
@pulumi/pulumi
for basic Pulumi operations and@pulumi/azure-native
to work with Azure resources. - We've defined our desired resource group name and the OpenShift Cluster name.
- We've provisioned a new Azure resource group to hold our ARO resources.
- We're creating an ARO cluster with a specified domain, pull secret, subnet IDs for the master and worker nodes, and some other necessary parameters like VM size for the nodes.
- We are exporting a placeholder for the Kubernetes configuration required to manage the cluster with
kubectl
. In a real scenario, you would obtain the kubeconfig from the created cluster.
Next steps after running this program:
Essentially, this is what you would do once the cluster is created and ready to use. The
kubeconfig
must be obtained from the created ARO cluster to proceed with these steps.-
Configure
kubectl
with the exported kubeconfig. -
Install Helm, which is a package manager for Kubernetes, on your local machine.
-
Use the
helm
CLI to deploy your Helm chart to the ARO cluster. Command can look like this:helm install rtf-test-api-instance <path-to-your-chart> --kubeconfig <path-to-kubeconfig>
Replace
<path-to-your-chart>
with the path to your rtf-test-api-instance Helm chart directory or tarball, and<path-to-kubeconfig>
with the path to your generated kubeconfig file.
Remember to replace placeholders and update values to match your configuration needs. The
kubeconfig
export is a placeholder and should be replaced with the logic to retrieve the actual kubeconfig from the ARO cluster once available. The code above assumes that the necessary networking resources like VNet and subnet exist. Ensure to update them according to your setup and provision them beforehand if necessary.