Deploy the flyte-sandbox helm chart on Google Kubernetes Engine (GKE)
TypeScriptTo deploy the Flyte sandbox Helm chart on Google Kubernetes Engine (GKE), you will need to perform the following steps:
-
Create a GKE Cluster: First, you'll need a Kubernetes cluster where Flyte will be deployed. Using Pulumi, we can define a GKE cluster using the
gcp.container.Cluster
resource. -
Install the Helm Chart: After the cluster is up and running, you'll use the Helm package manager to install the Flyte sandbox Helm chart into the cluster. Pulumi offers a Helm resource known as
helm.v3.Chart
which simplifies the Helm chart deployment process.
Below is a detailed Pulumi program written in TypeScript that performs these two steps. In this program, we create a GKE cluster and then use Helm to deploy Flyte sandbox.
We begin with setting up our imports and initializing a new Pulumi project:
import * as pulumi from "@pulumi/pulumi"; import * as gcp from "@pulumi/gcp"; import * as k8s from "@pulumi/kubernetes"; // Replace these variables with the desired configurations const projectName = "your-gcp-project-name"; // Your GCP project name const computeZone = "us-west1-b"; // The compute zone where the GKE cluster will be located
Next, let’s define our GKE cluster:
// Create a GKE cluster const cluster = new gcp.container.Cluster("flyte-cluster", { initialNodeCount: 2, nodeVersion: "latest", minMasterVersion: "latest", nodeConfig: { // Machine type can be adjusted based on your needs machineType: "n1-standard-1", oauthScopes: [ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring" ], }, project: projectName, // Your GCP project ID location: computeZone, }); // Export the Cluster name export const clusterName = cluster.name;
With the cluster configured, we establish a Kubernetes provider to interact with the GKE cluster. This utilizes the kubeconfig from the GKE cluster we just created:
// Setup a Kubernetes provider to interact with the GKE cluster const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), });
Once we have a Kubernetes provider, we use it to deploy the Flyte sandbox Helm chart on the cluster:
// Deploy the Flyte sandbox Helm chart const flyteChart = new k8s.helm.v3.Chart("flyte", { chart: "flyte", version: "0.6.28", // Specify the exact chart version to ensure the stability of your deployment. fetchOpts: { repo: "https://flyteorg.github.io/flyte" }, values: { // You can specify custom values for the Helm chart here if necessary }, }, { provider: k8sProvider }); // Make sure to pass the Kubernetes provider to this Helm chart resource
We'll finish by exporting any stack outputs. In this case, let's export the GKE cluster name:
// Export the name of the cluster export const gkeClusterName = cluster.name;
After deploying this program with Pulumi, the Flyte sandbox will be installed onto the GKE cluster you've created.
Remember to install the Pulumi CLI, set up your GCP credentials, and configure Pulumi for your GCP project before running your Pulumi program. Once your environment is set, you can run
pulumi up
to deploy your infrastructure.-