Deploy the voltha-adapter-openonu helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptDeploying a Helm chart on Oracle Kubernetes Engine (OKE) with Pulumi involves several steps. First, you need to create an OKE cluster, then you can use the
kubernetes
package to deploy a Helm chart onto the cluster.Below is a program in TypeScript using Pulumi to accomplish this. We will use the
oci
package for managing the Oracle Cloud Infrastructure resources and thekubernetes
package for deploying Helm charts.Step-by-Step Program Explanation:
-
Set up Oracle Cloud Infrastructure (OCI) provider: We begin by creating an instance of the OCI provider. This allows us to specify the necessary details for Pulumi to interact with your Oracle Cloud account.
-
Create a Kubernetes Cluster on OKE: We use the
oci.ContainerEngine.Cluster
resource to define an OKE Kubernetes cluster. We also provide necessary configurations like the VCN and subnet IDs which are prerequisites for creating an OKE cluster. -
Set up Kubernetes provider: After creating the OKE cluster, we need to set up the Kubernetes provider. The provider requires kubeconfig, which we get from the cluster details, allowing Pulumi to interact with our Kubernetes cluster.
-
Deploy a Helm chart: Using the
kubernetes.helm.v3.Chart
resource, we deploy thevoltha-adapter-openonu
Helm chart. The Helm chart's configuration details will depend on its available options and your specific needs.
Let's start with the Pulumi program:
import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; // You should have your OCI provider configuration set up which includes the compartment ID and other credentials // Typically, this would be set up in the Pulumi.OCI.yaml file or through environment variables. // First, we create an OKE cluster const cluster = new oci.ContainerEngine.Cluster("okeCluster", { // Here you should provide the compartment ID where your cluster will be located compartmentId: "your-compartment-id", vcnId: "your-vcn-id", kubernetesVersion: "v1.20.8", // Or other versions supported by OKE name: "volthaCluster", // Provide additional configurations as required for node pools, networking, etc. options: { kubernetesNetworkConfig: { podsCidr: "10.244.0.0/16", servicesCidr: "10.96.0.0/16", }, // Add further configurations such as add-ons, subnet IDs, etc. } // Don't forget to provide any necessary tags, depending on your company's or personal organizational needs }); // Now we need a Kubernetes provider that uses the kubeconfig from the newly created cluster const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: cluster.kubeConfig.content.apply((kubeconfig) => kubeconfig), }); // Now we use the Kubernetes provider to deploy the desired Helm Chart const helmChart = new k8s.helm.v3.Chart("openonuAdapterChart", { chart: "voltha-adapter-openonu", // Replace this with the correct repository URL or local chart path fetchOpts: { repo: "https://helm-repository-containing-openonu-chart.com/", }, // Any additional values you need to supply to the Helm Chart can be passed here values: { someValue: "some-setting", // chart-specific configuration }, }, { provider: k8sProvider }); // Export the cluster name and kubeconfig content for easy access export const clusterName = cluster.name; export const kubeConfigContent = cluster.kubeConfig.content;
Usage
- Save the program in a file named, for example,
index.ts
. - Ensure you have Pulumi and the OCI CLI installed and configured on your machine.
- Run
pulumi up
to execute this program. It will provision the infrastructure described by the code. - You can interact with your new Kubernetes cluster using
kubectl
through the exportedkubeConfigContent
. This will typically be placed in akubeconfig
file which you can point to using the KUBECONFIG environment variable, or by passing it directly tokubectl
with the--kubeconfig
flag.
Note on Configuration
While following this program, remember that you'll need to replace placeholder values like
your-compartment-id
,your-vcn-id
, and adjust other configurations like the Kubernetes version and chart-specific settings to match your use case. Also, ensure that you have the necessary IAM permissions to create and manage these resources in OCI.This program doesn't provide every setting for customization and assumes that you have certain resources like the VCN already created and configured. Adjustments may be required based on your existing OCI environment.
-