Deploy the ponnet helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptIn order to deploy the ponnet Helm chart on Oracle Kubernetes Engine (OKE), we’ll walk through the necessary steps using Pulumi. This includes setting up the required OKE cluster, and then using the
kubernetes
package to deploy a Helm chart.The main steps to deploy the ponnet Helm chart on OKE using Pulumi are:
- Define the OCI Kubernetes engine cluster using the appropriate Pulumi resource.
- Set up the Kubernetes provider to interact with the newly created OKE cluster.
- Use the Helm Chart resource from the Kubernetes package to deploy the ponnet chart to the OKE cluster.
Below, you’ll find a Pulumi program written in TypeScript to accomplish this task. It is structured in the following manner:
- Import the necessary Pulumi packages.
- Define configuration for the OCI provider, if required.
- Create an OKE cluster using the
oci.ContainerEngine.Cluster
resource. - Set up a Kubernetes provider pointing to the OKE cluster.
- Deploy the ponnet Helm chart using the
kubernetes.helm.v3.Chart
resource.
Please replace
YOUR_OCI_COMPARTMENT_ID
and any other place-holder values with the actual values from your environment.import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; const compartmentId = 'YOUR_OCI_COMPARTMENT_ID'; // Step 1: Create the OKE cluster const okeCluster = new oci.containerengine.Cluster("okeCluster", { compartmentId: compartmentId, kubernetesVersion: "v1.21.5", // Replace with the version you need name: "ponnet-cluster", options: { serviceLbSubnetIds: ["YOUR_SUBNET_ID_ONE", "YOUR_SUBNET_ID_TWO"], // Replace with your subnet IDs // Additional cluster options can be configured here }, vcnId: "YOUR_VCN_ID", // Replace with your VCN ID }); // Obtain the kubeconfig from the newly created OKE cluster const kubeconfig = pulumi. all([okeCluster.id, compartmentId]). apply(([clusterId, compartmentId]) => oci.containerengine.getClusterKubeconfig({ clusterId: clusterId, compartmentId: compartmentId, }) ); // Step 2: Use the kubeconfig to create a Kubernetes provider const k8sProvider = new k8s.Provider("k8sProvider", { kubeconfig: kubeconfig.content, }); // Step 3: Deploy the ponnet Helm chart to the OKE cluster const ponnetChart = new k8s.helm.v3.Chart("ponnetChart", { chart: "ponnet", // The repository containing the Helm chart. Replace with the actual repository URL. fetchOpts: { repo: "http://helm-repository-url/" }, // Any required chart values can be set here. values: { service: { type: 'LoadBalancer', }, }, }, { provider: k8sProvider }); // Export the cluster name and chart status export const clusterName = okeCluster.name; export const ponnetChartStatus = ponnetChart.status;
The above program creates an OKE cluster with the specified name and version. Make sure to replace placeholder values such as
YOUR_OCI_COMPARTMENT_ID
,YOUR_SUBNET_ID_ONE
, and so on with the actual values that you intend to use.Once the OKE cluster is created, we extract its kubeconfig, which is required to interact with the cluster via Kubernetes APIs. We then instantiate a Pulumi Kubernetes provider using this kubeconfig.
Finally, we deploy the ponnet Helm chart through Pulumi's Helm Chart resource which requires the name of the chart and potentially the repository where the chart can be found, as well as any configuration parameters for the chart specified under
values
.Remember, you would need to update the
fetchOpts
with the correct Helm repository URL where the ponnet chart is hosted. Further customization can be done through thevalues
object which can be tailored as per the chart's requirements.After the deployment, we are exporting the cluster name and chart status, which can be viewed using
pulumi stack output
after runningpulumi up
Remember to install the necessary Pulumi packages and setup OCI configuration for Pulumi to interact with your Oracle Cloud account before running your Pulumi program.