Deploy the minio-standalone helm chart on Google Kubernetes Engine (GKE)
TypeScriptTo accomplish your goal of deploying the minIO standalone Helm chart on Google Kubernetes Engine (GKE), we will create a Pulumi program in TypeScript. This program will perform the following steps:
- Provision a GKE cluster using GCP's
container.Cluster
resource. - Deploy the MinIO Helm chart to the provisioned GKE cluster.
Let's break down the process:
First, you'd need to set up a new GKE cluster. We use
gcp.container.Cluster
to define a Kubernetes cluster.Next, once the cluster is available, you can deploy applications using Helm charts. Pulumi has a resource
kubernetes.helm.v3.Chart
for this purpose, which allows deploying a Helm chart within a Kubernetes cluster.Here's the Pulumi TypeScript program that performs both steps:
import * as pulumi from '@pulumi/pulumi'; import * as gcp from '@pulumi/gcp'; import * as k8s from '@pulumi/kubernetes'; // Initialize GCP Config const config = new pulumi.Config('gcp'); const project = config.require('project'); const zone = config.require('zone'); // Create a GKE cluster const cluster = new gcp.container.Cluster('gke-cluster', { initialNodeCount: 2, nodeVersion: 'latest', minMasterVersion: 'latest', project: project, location: zone, }); // Export the Kubeconfig export const kubeconfig = pulumi. all([cluster.name, cluster.endpoint, cluster.masterAuth]). apply(([name, endpoint, masterAuth]) => { const context = `${project}_${zone}_${name}`; return `apiVersion: v1 clusters: - cluster: certificate-authority-data: ${masterAuth.clusterCaCertificate} server: https://${endpoint} name: ${context} contexts: - context: cluster: ${context} user: ${context} name: ${context} current-context: ${context} kind: Config preferences: {} users: - name: ${context} user: auth-provider: config: access-token: ${masterAuth.token} cmd-args: config config-helper --format=json cmd-path: gcloud expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp `; }); // The following command can be used to obtain the GKE credentials to use kubectl to interface with your cluster. // pulumi stack output kubeconfig > kubeconfig.yaml // You can make kubectl use this file as follows: // export KUBECONFIG=./kubeconfig.yaml // Create a provider for the above cluster const clusterProvider = new k8s.Provider('gke-k8s', { kubeconfig: kubeconfig, }); // Deploy MinIO Helm Chart const minio = new k8s.helm.v3.Chart('minio', { chart: 'minio', version: '8.0.10', // specify the version of the Helm chart namespace: 'default', fetchOpts:{ repo: "https://helm.min.io/", // MinIO Helm Chart repository }, values: { accessKey: 'your-minio-access-key', // replace with your values or generate them secretKey: 'your-minio-secret-key', // replace with your values or generate them resources: { requests: { memory: "2Gi", cpu: "2" } }, persistence: { size: "10Gi" } } }, { provider: clusterProvider }); // Export the MinIO IP address to access the MinIO web interface or REST API. It might take a couple of minutes to be reachable. export const minioIp = minio.getResourceProperty('v1/Service', 'minio', 'status').apply(status => status.loadBalancer.ingress[0].ip);
- This program starts by importing the necessary modules for Pulumi, GCP, and Kubernetes.
- We define our GCP project and zone, then create a GKE cluster using those values.
- We export the Kubeconfig which can be used with kubectl to interact with your new GKE cluster.
- We create a Kubernetes Provider which tells Pulumi how to communicate with the GKE cluster.
- We deploy the MinIO Helm chart to the
default
namespace usingk8s.helm.v3.Chart
.- Make sure you replace
'your-minio-access-key'
and'your-minio-secret-key'
with the actual credentials you want to use for MinIO. These should be kept secret and not exposed.
- Make sure you replace
- Finally, we export the IP address of the MinIO service, which will allow you to access the MinIO web interface once it's set up.
For more comprehensive details, you can refer to the Pulumi documentation for:
Remember to run
npm install @pulumi/pulumi @pulumi/gcp @pulumi/kubernetes
to install the necessary packages for this Pulumi program if it's a new project.- Provision a GKE cluster using GCP's