Deploy the supertokens helm chart on Linode Kubernetes Engine
TypeScriptDeploying a Helm chart on a Kubernetes cluster, such as the one provided by Linode Kubernetes Engine (LKE), can be accomplished with Pulumi through the
kubernetes
package. Thekubernetes.helm.v3.Chart
resource allows you to deploy Helm charts in a similar way you would usehelm install
orhelm upgrade
from the Helm CLI.In this example, we will use Pulumi with TypeScript to deploy the SuperTokens Helm chart to an LKE cluster. We assume that you have already set up Pulumi, have the necessary Pulumi credentials configured, and have access to a Linode Kubernetes cluster.
First, install the Pulumi CLI and log in to the Pulumi service. After these steps are complete, initialize a new Pulumi TypeScript project using
pulumi new typescript
.Within the project, you'll write code similar to what's shown below. This program will use the
@pulumi/kubernetes
package to deploy the SuperTokens Helm chart to your LKE cluster. Ensure you have added the appropriate repository that contains the SuperTokens Helm chart since this chart is not included in the default Helm repositories.Here's the TypeScript code that accomplishes this:
import * as k8s from "@pulumi/kubernetes"; // Deploy a chart from a Helm repository const superTokensRelease = new k8s.helm.v3.Chart("super-tokens", { repo: "helm repo url", // Replace with the repository URL for SuperTokens chart: "super-tokens", version: "chart-version", // Specify the version of the chart you wish to deploy // Values to pass to the Helm chart, customize these values based on SuperTokens' requirements values: { // ... (key/value pairs matching the values.yaml structure for the SuperTokens chart) }, // The namespace to deploy into, if not specified it defaults to 'default' namespace namespace: "super-tokens-namespace", // Replace with your desired namespace or omit to use the default namespace }); // Export the base URL to access the deployed SuperTokens application export const superTokensUrl = superTokensRelease.getResourceProperty("v1/Service", "super-tokens-service", "status") .then(status => `http://${status.loadBalancer.ingress[0].ip}`); // Adjust based on how SuperTokens is exposed (e.g., ingress controller, LoadBalancer service)
In the code above, replace
'helm repo url'
with the actual repository URL where the SuperTokens Helm chart is located and'chart-version'
with the version of the Helm chart you wish to install. Also, adjust thevalues
object to set any configuration options required for SuperTokens. Thenamespace
argument is optional and defaults to 'default' if not provided.Remember to replace
super-tokens-service
with the correct name of the service that the SuperTokens Helm chart deploys. This name is typically provided in the Helm chart's documentation or by inspecting thevalues.yaml
file included in the chart. Theexport
statement is meant to provide the URL to access the SuperTokens application, which may differ based on your actual deployment topology.After you've written this program:
- Run
pulumi up
to deploy your changes. Pulumi will print out the status of resources being deployed and will prompt for confirmation before making any changes. - After confirming, Pulumi will execute the deployment and when complete, print out the export you specified (
superTokensUrl
in this case).
The exported value is the LoadBalancer IP for the SuperTokens service if it is exposed through a LoadBalancer. If you are using an Ingress controller or another method to route traffic to the service, you will need to adjust the export logic to retrieve the appropriate hostname or address.
Please replace placeholder values like
'helm repo url'
,'chart-version'
,'super-tokens-service'
, and'super-tokens-namespace'
with actual values applicable to your scenario.Remember to run
npm install
in your Pulumi project directory before runningpulumi up
to ensure all dependencies are installed.- Run