Deploy the blockscout helm chart on Azure Managed Openshift Service
TypeScriptIn this guide, we'll walk through the process of deploying a Helm chart on an Azure Managed OpenShift Service using Pulumi. Helm is the package manager for Kubernetes, and it allows you to define, install, and upgrade even the most complex Kubernetes applications. Here, we're targeting BlockScout, an open-source Ethereum block explorer, to be deployed on OpenShift.
The steps we need to take include:
- Setting up an Azure Managed OpenShift Service cluster.
- Installing the BlockScout Helm chart on the OpenShift cluster.
We'll use two main Pulumi resources for this:
azure-native.containerservice.OpenShiftManagedCluster
: This resource will set up an Azure Managed OpenShift cluster where our Helm chart will be deployed.kubernetes.helm.v3.Chart
: This resource represents a Helm chart in a Pulumi program, allowing us to deploy third-party applications defined by Helm charts.
Let's start by setting up our Pulumi TypeScript program:
First, we need to ensure that we have the correct packages installed:
npm install @pulumi/azure-native @pulumi/kubernetes
Now, let's write the TypeScript program:
import * as azure from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Define the OpenShift Managed Cluster resource. const openshiftCluster = new azure.containerservice.OpenShiftManagedCluster("myOpenShiftCluster", { // Replace the below parameters with the appropriate values. // Note the location should support Azure Managed OpenShift Service. resourceGroupName: "myResourceGroup", resourceName: "myCluster", location: "eastus", openShiftVersion: "4.3", // Ensure to use a supported OpenShift version. tags: { project: "BlockScout Deployment", }, networkProfile: { vnetCidr: "10.0.0.0/8", }, masterPoolProfile: { count: 3, // 3 is recommended for production environments for reliability. vmSize: "Standard_D8s_v3", }, agentPoolProfiles: [{ name: "agentpool", count: 3, vmSize: "Standard_D8s_v3", }], }); // Step 2: Create a Kubernetes provider instance using the kubeconfig from the OpenShift cluster. const k8sProvider = new k8s.Provider("openshiftK8s", { kubeconfig: openshiftCluster.kubeconfig.apply(kubeconfig => kubeconfig.rawData), }); // Step 3: Define the Helm chart for BlockScout. The chart details need to be specified according to its repository. const blockScoutChart = new k8s.helm.v3.Chart("blockscout", { chart: "blockscout", version: "1.0.0", // Specify the chart version you want to deploy. fetchOpts: { repo: "http://helm-repository-url.com", // Replace with the actual Helm repo URL for BlockScout. }, }, { provider: k8sProvider }); // Export the cluster's kubeconfig and BlockScout service endpoint. export const kubeconfig = openshiftCluster.kubeconfig; export const blockScoutEndpoint = blockScoutChart.getResource("v1/Service", "default", "blockscout").status.apply(status => status.loadBalancer.ingress[0].ip);
In the above program:
- We initialize a new OpenShift Managed Cluster in Azure with a specified version, location, and VM sizes for master and agent nodes.
- We create a Kubernetes provider that allows Pulumi to communicate with the OpenShift cluster. It uses the kubeconfig provided by the cluster resource, which contains all necessary access information.
- We define the Helm chart for BlockScout using the
kubernetes.helm.v3.Chart
resource. Therepo
property should point to the URL of the BlockScout Helm chart repository. (The URL provided is a placeholder and should be replaced with the actual repository URL.) - We export the kubeconfig and the BlockScout service endpoint so that they can be easily retrieved after deployment. The endpoint enables you to interact with the BlockScout application from your browser.
By running this program with the Pulumi CLI, you'll create an OpenShift cluster and deploy the BlockScout Helm chart to it. To access your BlockScout instance, you would use the output
blockScoutEndpoint
.Remember that this high-level overview assumes that the BlockScout Helm chart is properly configured and available in a Helm chart repository. Adjustments to chart version and parameters should be made according to the specific chart you're using.