Deploy the ztncui helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the
ztncui
Helm chart on Azure Managed OpenShift Service, we'll go through the following steps:- Create an Azure Managed OpenShift cluster using the
azure-native.containerservice.OpenShiftManagedCluster
resource. - Install the Helm chart on the OpenShift cluster using the
kubernetes.helm.sh/v3.Chart
resource.
Let's break down the process step by step.
Step 1: Create an Azure Managed OpenShift Cluster
Firstly, we need to provision an OpenShift cluster in Azure. We will use the Pulumi
azure-native
provider, which interacts with Azure resources in a native way. Specifically, we will use theazure-native.containerservice.OpenShiftManagedCluster
resource to create an OpenShift Managed Cluster. The OpenShift cluster provides a Kubernetes-compatible environment with additional enterprise security and features.For this, you need to define certain mandatory parameters such as the location of the resources and the version of OpenShift. You'd also need to define the
agentPoolProfiles
which determines the size, type, and number of nodes for your cluster. The agent pools are VMs that run your applications and services.Step 2: Deploy the Helm Chart
Once the cluster is up and running, you can deploy applications using Helm charts. Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application.
In Pulumi, we use the
kubernetes.helm.sh/v3.Chart
resource to deploy a Helm chart onto the Kubernetes cluster. The resource properties will typically include therepo
,chart
,version
, andvalues
, wherevalues
are used to provide configuration to the Helm chart.Here is the Pulumi program in TypeScript that demonstrates how to deploy the
ztncui
Helm chart on an Azure Managed OpenShift cluster.import * as pulumi from "@pulumi/pulumi"; import * as azureNative from "@pulumi/azure-native"; import * as kubernetes from "@pulumi/kubernetes"; // Step 1: Create an Azure Managed OpenShift Cluster const managedCluster = new azureNative.containerservice.OpenShiftManagedCluster("myOpenShiftCluster", { // Required properties location: "West US", // specify the location here openShiftVersion: "4.3", // specify the OpenShift version here resourceGroupName: "myResourceGroup", // specify your resource group name here resourceName: "myCluster", // Specify the profile for the cluster service principal or identity // For example purposes, the clientId and secret are hardcoded, you might fetch these from config or a secret store servicePrincipalProfile: { clientId: "yourServicePrincipalClientId", secret: "yourServicePrincipalSecret", }, // Define agent pool profile using an array agentPoolProfiles: [{ name: "agentpool", count: 3, vmSize: "Standard_DS2_v2", role: "compute", osType: "Linux", }], // Other properties can be set as needed }); // Step 2: Deploy the ztncui Helm chart to the Azure Managed OpenShift Cluster const ztncuiChart = new kubernetes.helm.v3.Chart("ztncui", { // Helm chart repository options fetchOpts: { repo: "https://helm-repo-url/", // Replace with the actual Helm repo URL for ztncui }, // Specify the Helm chart and version chart: "ztncui", version: "chart-version", // Replace with the actual Helm chart version for ztncui // Provide an empty object if no values are needed; otherwise, populate with configuration values values: {}, // Reference the OpenShift cluster created earlier // Make sure to configure the Kubernetes provider to interact with the created OpenShift cluster }, { provider: new kubernetes.Provider("k8sProvider", { kubeconfig: managedCluster.kubeconfig.apply(JSON.stringify) })}); // Export the Kubernetes provider kubeconfig and the cluster endpoint export const kubeconfig = managedCluster.kubeconfig; export const clusterEndpoint = managedCluster.clusterEndpoint;
Explanation:
- The
azureNative.containerservice.OpenShiftManagedCluster
defines the Azure Managed OpenShift cluster with specific configurations like location, version, resource group, and agent pool profiles. - The
kubernetes.helm.sh/v3.Chart
resource is used to install theztncui
Helm chart into the OpenShift cluster. - The
kubeconfig
andclusterEndpoint
are exported to allow you to interact with the cluster using kubectl after the deployment. - You should replace placeholder strings like
yourServicePrincipalClientId
andchart-version
with actual values specific to your scenario. - Ensure that you have the correct Helm repo URL for the
ztncui
chart.
Keep in mind that it's crucial to secure your service principal credentials and not to expose them in your code. You would use Pulumi secrets or environmental variables in practice, but for the purpose of this illustration, they are included as placeholders.
After running this Pulumi program, it will provision an Azure Managed OpenShift service and deploy the
ztncui
Helm chart onto it. The resulting infrastructure will include an OpenShift Kubernetes cluster with theztncui
application running inside.- Create an Azure Managed OpenShift cluster using the