Create Google GKE cluster

This section will help you create a Saagie-compatible Kubernetes cluster using the Google Kubernetes Engine (GKE).

1. Prerequisites

You need to setup your computer before creating a new cluster.

2. Create or configure cluster

  • Create new cluster

  • Configure existing cluster

  1. To create your cluster in the gcloud command line, run the following command:

    gcloud container clusters create <cluster name> --version <version> --zone <zone> --num-nodes=3 -m n1-standard-4 --enable-network-policy (1)(2)(3)
    1 Replace <version> with a Kubernetes version that is compatible with Saagie. Current compatible versions are 1.14.x and 1.15.x.
    2 Replace <cluster name> and <zone> with your values.
    3 n1-standard-4 is the minimum machine type that supports machine node and storage prerequisites.
  2. You can also create your cluster with the Google Cloud Console, though we recommend using the gcloud command line.

  1. Run the following command:

    gcloud container clusters get-credentials <cluster name> --zone <zone> (1)
    1 Replace <cluster name> and <zone> with your cluster name and zone.
  2. If you’d prefer to use the Google Console, create your configuration file according to the following instructions.

  3. Once your configuration file is created, check the connectivity.

    • Open your Google Console and select Connect for your cluster.

    • You will receive a command to create or update your $HOME/kube/config file.

Refer to the Kubernetes documentation if needed.

3. Verify your Kubernetes cluster

Once you have created your cluster, verify that you have access to your Kubernetes cluster.

  1. Open your Google Console and select Connect for your cluster.

  2. Run the following command to verify that you have access to your Kubernetes cluster:

    kubectl get nodes
  3. The output should be similar to this:

    NAME                               STATUS   ROLES    AGE    VERSION
    gke-tests1811-pool-d3d39e4c-ct5j   Ready    <none>   141m   v1.14.10-gke.37
    gke-tests1811-pool-d3d39e4c-jhhq   Ready    <none>   141m   v1.14.10-gke.37
    gke-tests1811-pool-d3d39e4c-pzxf   Ready    <none>   141m   v1.14.10-gke.37
All nodes must have the status ready.

4. Create storage classes

The storage.yml file contains the configuration for your storageClass resources:

  • common-storageclass: Used to store Saagie data, such as databases.

  • <prefix>-storageclass: Used to store job data, such as uploaded artifacts.

  • <prefix>-app-storageclass: Optional storageClass if you want to store app data and job data on different provisioner.

    <prefix> is the same value you determined for your DNS entry.

4.1. Create a storage.yml file

Here is a sample storage.yml for Google GKE that can be customized according to your needs:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: common-storageclass
parameters:
  type: pd-standard
provisioner: kubernetes.io/gce-pd
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-storageclass (1)
parameters:
  type: pd-standard
provisioner: kubernetes.io/gce-pd

To store app data and job data on different provisioners, include the following in the same storage.yml file:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-app-storageclass (1)
parameters: (2)

provisioner: (3)
1 Replace <prefix> with the same value determined for your DNS entry.
2 Add the parameters for app data.
3 Indicate your second provisioner used to store app data.

4.2. Apply storage.yml

  1. Run the following command to apply your storage.yml file:

    kubectl apply -f storage.yml
  2. Run the following command to confirm that the storage classes are available:

    kubectl get sc
Next step

After creating or configuring your cluster, continue to Prepare your Kubernetes cluster.