> This page location: /docs.md > /docs/management.md > /docs/kubernetes/current.md > /docs/kubernetes/current/reference-architectures.md > /docs/kubernetes/current/reference-architectures/multi-cluster/overview.md

> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# GKE Clusters

Kubernetes is not vendor specific; however, for the sake of providing explicit and complete instructions for deploying all elements of a multi-cluster Kubernetes Operator implementation, this section walks you through the process of deploying multiple Kubernetes clusters on GCP (Google Cloud Platform) specifically.

## Prerequisites

Before you begin, perform the following actions:

- Create a GCP (Google Cloud Platform) account.

- Prepare a GCP (Google Cloud Platform) project so that you can use it to create [GKE (Google Kubernetes Engine)](https://cloud.google.com/kubernetes-engine) clusters.

- Install the GCP (Google Cloud Platform) [CLI.](https://cloud.google.com/sdk/docs/install)

- [Authenticate](https://cloud.google.com/docs/authentication/gcloud) with the `gcloud auth login` command.

- Update as needed and set the environment variables defined in the following  `env_variables.sh` file.

```bash
# GCP project name - this is the only parameter that is mandatory to change here
export MDB_GKE_PROJECT="${MDB_GKE_PROJECT:="### Set your GKE project name here ###"}"

# Adjust the values for each Kubernetes cluster in your deployment.
# The deployment script references the following variables to get values for each cluster.
export K8S_CLUSTER_0="k8s-mdb-0${K8S_CLUSTER_SUFFIX:-""}"
export K8S_CLUSTER_0_ZONE="europe-central2-a"
export K8S_CLUSTER_0_NUMBER_OF_NODES=3
export K8S_CLUSTER_0_MACHINE_TYPE="e2-standard-4"
export K8S_CLUSTER_0_CONTEXT_NAME="gke_${MDB_GKE_PROJECT}_${K8S_CLUSTER_0_ZONE}_${K8S_CLUSTER_0}"

export K8S_CLUSTER_1="k8s-mdb-1${K8S_CLUSTER_SUFFIX:-""}"
export K8S_CLUSTER_1_ZONE="europe-central2-b"
export K8S_CLUSTER_1_NUMBER_OF_NODES=3
export K8S_CLUSTER_1_MACHINE_TYPE="e2-standard-4"
export K8S_CLUSTER_1_CONTEXT_NAME="gke_${MDB_GKE_PROJECT}_${K8S_CLUSTER_1_ZONE}_${K8S_CLUSTER_1}"

export K8S_CLUSTER_2="k8s-mdb-2${K8S_CLUSTER_SUFFIX:-""}"
export K8S_CLUSTER_2_ZONE="europe-central2-c"
export K8S_CLUSTER_2_NUMBER_OF_NODES=1
export K8S_CLUSTER_2_MACHINE_TYPE="e2-standard-4"
export K8S_CLUSTER_2_CONTEXT_NAME="gke_${MDB_GKE_PROJECT}_${K8S_CLUSTER_2_ZONE}_${K8S_CLUSTER_2}"

# Preemptible nodes disabled — caused random mid-test evictions in CI.
# export GKE_SPOT_INSTANCES_SWITCH="--preemptible"

```

## Source Code

You can find all included source code in the [MongoDB Kubernetes Operator repository.](https://github.com/mongodb/mongodb-kubernetes/tree/1.15.0/public/architectures/setup-multi-cluster/ra-01-setup-gke)

## Procedure

1. Set your default gcloud project:

   ```bash
   gcloud config set project "${MDB_GKE_PROJECT}"

   ```

2. Create Kubernetes clusters.

   Create three [GKE (Google Kubernetes Engine)](https://cloud.google.com/kubernetes-engine) clusters:

   ```bash
   gcloud container clusters create "${K8S_CLUSTER_0}" \
         --zone="${K8S_CLUSTER_0_ZONE}" \
         --num-nodes="${K8S_CLUSTER_0_NUMBER_OF_NODES}" \
         --machine-type "${K8S_CLUSTER_0_MACHINE_TYPE}" \
         --tags=mongodb \
         ${GKE_SPOT_INSTANCES_SWITCH:+${GKE_SPOT_INSTANCES_SWITCH}}

   ```

   ```bash
   gcloud container clusters create "${K8S_CLUSTER_1}" \
         --zone="${K8S_CLUSTER_1_ZONE}" \
         --num-nodes="${K8S_CLUSTER_1_NUMBER_OF_NODES}" \
         --machine-type "${K8S_CLUSTER_1_MACHINE_TYPE}" \
         --tags=mongodb \
         ${GKE_SPOT_INSTANCES_SWITCH:+${GKE_SPOT_INSTANCES_SWITCH}}

   ```

   ```bash
   gcloud container clusters create "${K8S_CLUSTER_2}" \
         --zone="${K8S_CLUSTER_2_ZONE}" \
         --num-nodes="${K8S_CLUSTER_2_NUMBER_OF_NODES}" \
         --machine-type "${K8S_CLUSTER_2_MACHINE_TYPE}" \
         --tags=mongodb \
         ${GKE_SPOT_INSTANCES_SWITCH:+${GKE_SPOT_INSTANCES_SWITCH}}

   ```

3. Store credentials in your kubeconfig.

   Obtain credentials and save contexts to the current `kubeconfig` file. By default, this file is located in the `~/.kube/config` directory and referenced by the `$KUBECONFIG` [environment variable.](https://www.mongodb.com/docs/kubernetes/current/tutorial/deploy-om-multi-cluster.md#std-label-set-env-vars-om-mc)

   ```bash
   gcloud container clusters get-credentials "${K8S_CLUSTER_0}" --zone="${K8S_CLUSTER_0_ZONE}"
   gcloud container clusters get-credentials "${K8S_CLUSTER_1}" --zone="${K8S_CLUSTER_1_ZONE}"
   gcloud container clusters get-credentials "${K8S_CLUSTER_2}" --zone="${K8S_CLUSTER_2_ZONE}"

   ```

   All `kubectl` commands reference these contexts using the following variables:

   - `$K8S_CLUSTER_0_CONTEXT_NAME`

   - `$K8S_CLUSTER_1_CONTEXT_NAME`

   - `$K8S_CLUSTER_2_CONTEXT_NAME`

4. Verify that `kubectl` has access to Kubernetes clusters.

   ```bash
   echo "Nodes in cluster ${K8S_CLUSTER_0_CONTEXT_NAME}"
   kubectl --context "${K8S_CLUSTER_0_CONTEXT_NAME}" get nodes
   echo; echo "Nodes in cluster ${K8S_CLUSTER_1_CONTEXT_NAME}"
   kubectl --context "${K8S_CLUSTER_1_CONTEXT_NAME}" get nodes
   echo; echo "Nodes in cluster ${K8S_CLUSTER_2_CONTEXT_NAME}"
   kubectl --context "${K8S_CLUSTER_2_CONTEXT_NAME}" get nodes

   ```

   **Output:**

   ```text
   Nodes in cluster gke_scratch-kubernetes-team_europe-central2-a_k8s-mdb-0-cabcbfd835d45fd33b
   NAME                                                  STATUS   ROLES    AGE    VERSION
   gke-k8s-mdb-0-cabcbfd835-default-pool-41737e6e-52hc   Ready    <none>   112s   v1.36.4-gke.1391002
   gke-k8s-mdb-0-cabcbfd835-default-pool-41737e6e-7pds   Ready    <none>   113s   v1.36.4-gke.1391002
   gke-k8s-mdb-0-cabcbfd835-default-pool-41737e6e-k76f   Ready    <none>   113s   v1.36.4-gke.1391002

   Nodes in cluster gke_scratch-kubernetes-team_europe-central2-b_k8s-mdb-1-cabcbfd835d45fd33b
   NAME                                                  STATUS   ROLES    AGE   VERSION
   gke-k8s-mdb-1-cabcbfd835-default-pool-a593e388-0m6k   Ready    <none>   36s   v1.36.4-gke.1391002
   gke-k8s-mdb-1-cabcbfd835-default-pool-a593e388-5zq5   Ready    <none>   32s   v1.36.4-gke.1391002
   gke-k8s-mdb-1-cabcbfd835-default-pool-a593e388-zppj   Ready    <none>   31s   v1.36.4-gke.1391002

   Nodes in cluster gke_scratch-kubernetes-team_europe-central2-c_k8s-mdb-2-cabcbfd835d45fd33b
   NAME                                                  STATUS   ROLES    AGE   VERSION
   gke-k8s-mdb-2-cabcbfd835-default-pool-4a9f72a1-hn1q   Ready    <none>   44s   v1.36.4-gke.1495002

   ```
