Deploy the redis-setup helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy the
redis-setup
Helm chart on the Oracle Kubernetes Engine (OKE), we will follow these steps in the Pulumi program:- Create an instance of the OKE cluster using the
oci.ContainerEngine.Cluster
resource. This will initiate and configure a Kubernetes cluster within your Oracle Cloud Infrastructure (OCI) compartment. - Use the
kubernetes.helm.sh/v3.Chart
resource from Pulumi's Kubernetes provider to deploy theredis-setup
Helm chart onto the OKE cluster.
Starting with the OKE cluster creation, we'll define the necessary components such as the Virtual Cloud Network (VCN) ID, the desired Kubernetes version, and other configurations required by OKE.
After setting up the cluster, we will configure the Kubernetes provider to use the kubeconfig from the OKE cluster, allowing Pulumi to deploy resources onto the cluster.
Finally, we'll deploy the
redis-setup
Helm chart by specifying its name and any other relevant Helm configuration options. If theredis-setup
chart requires specific values, they can be provided through thevalues
property.Here is the TypeScript program outlining these steps:
import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as kubernetes from "@pulumi/kubernetes"; // Initialize the Oracle Cloud provider. const provider = new oci.Provider("oci", { region: "us-phoenix-1" }); // Specify the OCI compartment ID where you want to launch the OKE cluster. const compartmentId = "YOUR_OCI_COMPARTMENT_ID"; // Create an Oracle Kubernetes Engine cluster. const okeCluster = new oci.ContainerEngine.Cluster("okeCluster", { compartmentId: compartmentId, kubernetesVersion: "v1.21.0", // Specify your desired Kubernetes version. name: "redisCluster", vcnId: "YOUR_VCN_ID", // Specify the VCN ID where the cluster should be provisioned. options: { serviceLbSubnetIds: ["SUBNET_ID_1", "SUBNET_ID_2"], // Replace with your Subnet IDs if you want to use LoadBalancers. }, }, { provider: provider }); // Create a kubeconfig to connect to the OKE cluster. const kubeconfig = pulumi.all([okeCluster.id]).apply(([clusterId]) => { return oci.containerengine.getClusterKubeconfig({ clusterId: clusterId, }, { provider: provider }); }); // Create an instance of the Kubernetes provider with the kubeconfig from the OKE cluster. const k8sProvider = new kubernetes.Provider("k8sProvider", { kubeconfig: kubeconfig.kubeconfig, }); // Deploy the `redis-setup` Helm chart onto the OKE cluster using the Kubernetes provider. const redisChart = new kubernetes.helm.v3.Chart("redisSetup", { chart: "redis", // If `redis-setup` is a custom chart that you've packaged, specify the path or repository as required. // For example, you can use the `repo` parameter to point to the chart's repository URL. // repo: "http://charts.example.com/", // If the `redis-setup` requires specific values, you could specify them as an object. // values: { ... } }, { provider: k8sProvider }); // Export the cluster name and kubeconfig export const clusterName = okeCluster.name; export const clusterKubeconfig = kubeconfig.kubeconfig;
Replace
YOUR_OCI_COMPARTMENT_ID
,YOUR_VCN_ID
, and other placeholders with the actual values specific to your environment. Thevalues
parameter is where you would place any customization needed for theredis-setup
Helm chart.Ensure you have the Pulumi CLI and Oracle Cloud Infrastructure CLI installed and configured correctly to interact with your Oracle Cloud account. Run this program using the Pulumi CLI to create the infrastructure and deploy the chart:
pulumi up
After the deployment finishes successfully, you should have a running instance of Redis on your OKE cluster.
- Create an instance of the OKE cluster using the