Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deploy vCluster on GKE #368

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/styles/config/vocabularies/Loft/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ Pro
AWS
[Ee][Kk][Ss]
GKE
GCP
AKS
22 changes: 22 additions & 0 deletions docs/_partials/managed_k8s_install_vcluster.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Create virtual cluster

Create a virtual cluster using the CLI:

```bash title="Create virtual cluster"
vcluster create my-vcluster --namespace team-x
```

### Verify the Installation

Check if vCluster pods are running:

```bash title="Check vCluster pods"
kubectl get pods -n team-x
```

You should see output similar to:
```
NAME READY STATUS RESTARTS AGE
coredns-666d64755b-k5njg-x-kube-system-x-my-vcluster 1/1 Running 0 3m11s
my-vcluster-0 1/1 Running 0 6m33s
```
107 changes: 107 additions & 0 deletions vcluster/deploy/environment/gke.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
title: Deploy on GKE
sidebar_label: GKE
sidebar_position: 8
id: gke
description: Learn how to deploy vCluster on Google Kubernetes Engine (GKE), including storage provisioning and Workload Identity configuration.
---

import BasePrerequisites from '../../../platform/_partials/install/base-prerequisites.mdx';
import Mark from "@site/src/components/Mark";
import InstallCli from '../../_partials/deploy/install-cli.mdx';
import KubeconfigUpdate from '../../../docs/_partials/kubeconfig_update.mdx';
import ManagedK8sInstallVcluster from '../../../docs/_partials/managed_k8s_install_vcluster.mdx';

import ProAdmonition from '../../_partials/admonitions/pro-admonition.mdx';


# Deploy vCluster on GKE
Piotr1215 marked this conversation as resolved.
Show resolved Hide resolved

This guide provides step-by-step instructions for deploying `vCluster` on [Google Kubernetes Engine (GKE)](https://cloud.google.com/kubernetes-engine).

## Prerequisites

Before starting, ensure you have the following tools installed:

- `kubectl`: Kubernetes command-line tool for interacting with the cluster. See [Install and Set Up kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) for installation instructions.
- vCluster CLI <InstallCli />
- [Google Cloud SDK (`gcloud` CLI)](https://cloud.google.com/sdk/docs/install)
Piotr1215 marked this conversation as resolved.
Show resolved Hide resolved
:::note
Ensure you have the necessary IAM permissions to create clusters and manage cloud services.
:::

## Create GKE cluster

Start by creating a zonal GKE cluster using the `gcloud` CLI. First, set up your environment variables:

:::tip
Project ID can be found in the Google Cloud Console under the project name.
Piotr1215 marked this conversation as resolved.
Show resolved Hide resolved
Alternatively use `gcloud project list` to list all projects and their IDs.
To check which project is active, use `gcloud config get-value project`.
:::

```bash title="Set environment variables"
export PROJECT_ID=development
export CLUSTER_NAME=vcluster-demo
export ZONE=europe-west1-b
export MACHINE_TYPE=e2-standard-4
```


Configure `gcloud` and enable the required APIs and set default project:

```bash title="Configure gcloud"
gcloud config set project $PROJECT_ID
gcloud services enable container.googleapis.com
```

Create the cluster:

```bash title="Create GKE cluster"
gcloud container clusters create $CLUSTER_NAME \
--zone $ZONE \
--machine-type $MACHINE_TYPE \
--num-nodes 2
```

:::info
This process typically takes about 10-15 minutes.
:::

This command creates a GKE cluster named vcluster-demo in the europe-west1-b
zone with two nodes of type e2-standard-4.

<KubeconfigUpdate />

### Verify the cluster creation

Verify the cluster by listing the nodes:

```bash title="List cluster nodes"
kubectl get nodes
```

You should see output similar to:
```
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
vcluster-demo europe-west1-b 1.30.5-gke.1443001 35.187.66.218 e2-standard-4 1.30.5-gke.1443001 2 RUNNING
```

<ManagedK8sInstallVcluster />

## Next steps

Now that you have vCluster running on GKE, consider setting up the [platform UI](/platform/install/quick-start-guide) to mange your virtual clusters.

<ProAdmonition />

When using the platform you can easily enable [Workload Identity](/vcluster/integrations/pod-identity/gke-workload-identity).
Piotr1215 marked this conversation as resolved.
Show resolved Hide resolved

## Cleanup

If you deployed the GKE cluster with this tutorial, and want to clean up the resources, run the
following command:

```bash title="Clean up resources"
gcloud container clusters delete $CLUSTER_NAME --zone $ZONE --quiet
```