Deploy the supabase helm chart on Kubernetes
TypeScriptTo deploy the Supabase Helm chart on Kubernetes using Pulumi, we will primarily utilize the
kubernetes.helm.v3.Chart
resource from the Pulumi Kubernetes provider. This resource allows you to deploy Helm charts into a Kubernetes cluster. Using a Helm chart is convenient because it packages all the Kubernetes resources needed to deploy an application, like Supabase, into a single, versionable artifact that can be easily managed with Helm's tools.Here's a step-by-step guide with a Pulumi program in TypeScript to deploy the Supabase Helm chart:
-
Setup: Before you start, you must have a Kubernetes cluster running and configured. You can use Pulumi to provision a cluster if you don't have one. Ensure your
kubectl
is configured to connect to your Kubernetes cluster. -
Helm Chart: Helm charts can be found in Helm repositories. The Supabase Helm chart is available in its Helm repository. You'll need to add the repository to your Helm client with
helm repo add
. -
Pulumi Program: In the Pulumi program below, we're creating an instance of the
Chart
resource. We specify the chart name (supabase
), version, and values that configure the release. Custom values for the chart can be passed in via thevalues
argument which is a map of configuration parameters.
Now, let's write the Pulumi program:
import * as k8s from "@pulumi/kubernetes"; // Define the Supabase Helm chart version and repository URL. const supabaseChartVersion = "0.0.1"; // replace with the actual chart version you intend to deploy const supabaseRepoUrl = "https://supabase.github.io/charts"; // the Supabase Helm repository // Deploy the Supabase Helm chart into the Kubernetes cluster. const supabaseChart = new k8s.helm.v3.Chart("supabase-chart", { chart: "supabase", version: supabaseChartVersion, fetchOpts: { repo: supabaseRepoUrl, }, // You can specify custom values according to the Supabase chart's documentation values: { // For example, if you need to customize the PostgreSQL password: postgresql: { postgresqlPassword: "yourStrongPassword", // Replace with your desired password }, // Add other custom configuration values here }, }); // Export the endpoint to access Supabase export const supabaseEndpoint = supabaseChart.getResourceProperty( "v1/Service", "supabase-chart-supabase", "status" ).apply(status => status.loadBalancer.ingress[0].ip);
In the above code:
- We import the necessary Pulumi and Kubernetes packages.
- We create the
supabaseChart
using thekubernetes.helm.v3.Chart
class, which deploys the chart. - We specify the chart's version and the repository where the chart can be found.
- We use the
values
field to provide custom configuration values. This example demonstrates setting a custom password for the PostgreSQL database that comes with Supabase. You will need to replace"yourStrongPassword"
with your own strong password. - We use the
getResourceProperty
method to fetch the IP address of the load balancer created for Supabase, which can be used as the endpoint for connecting to your Supabase services.
Finally, the
supabaseEndpoint
is exported, which gives you the IP you can use to access Supabase once it's fully deployed.Please remember to check the official Supabase Helm chart documentation for the most up-to-date configuration options and installation instructions.
Before running this program, ensure Pulumi CLI is installed and configured for TypeScript, and you are authenticated with your Kubernetes cluster. After setting up your Pulumi program, you can deploy it using the following commands:
pulumi up
This will start the deployment process, and Pulumi will report the progress and results. If the process is successful, the endpoint to access Supabase will be displayed as an output.
Remember to update the
supabaseChartVersion
with the actual version of the Supabase Helm chart you want to deploy, and to configure any additional settings as needed using thevalues
property.-