Lifecycle
Google Kubernetes Engine (GKE) is a fully managed Kubernetes service provided by Google Cloud. We have developed an integration with GKE to ensure that users can provision GKE Clusters in any region and Google Cloud project using CLI (RCTL).
Create Cluster¶
Imperative¶
Use this command to create an GKE cluster object in the configured project on the controller. You can optionally also specify the cluster blueprint during this step.
To create an GKE cluster, zone and Google Cloud project name are mandatory.
./rctl create cluster gke gke-cluster --zone us-west2-a --gkeproject demo-gke --location gcp/us-west2
To create an GKE cluster with cluster autoscaler enabled and a custom blueprint:
./rctl create cluster gke rctl-gke-cluster-auto-scale --zone us-west2-a --gkeproject demo-gke --location gcp/us-west2 --enable-autoscaling --min-nodes 1 --max-nodes 3 --blueprint standard-blueprint
Note
In the current version, RCTL assumes that you have gcloud CLI and kubectl installed. gcloud CLI has to be configured with the correct credential details where you want to provision GKE cluster.
Declarative¶
You can also create the cluster based on a version controlled cluster spec that you can store in a Git repository. This enables users to develop automation for reproducible infrastructure.
./rctl create cluster -f cluster-spec.yml
An illustrative example of the cluster spec YAML file for GKE is shown below
kind: Cluster
metadata:
# display name of cluster
name: demo-gke-cluster
project: Sandbox
spec:
type: gke
# field below is optional, if not specified, default value is "default"
# blueprint: rctl-test-blueprint
# location, can be custom or predefined
location: gcp/us-west2
# Google Cloud project. Name of project in Google Cloud.
gkeproject: demo-gke
# Google Cloud Region
gkeregion: us-west2
# Google Cloud Zone
gkezone: us-west2-a
# GKE Google Cloud Deployment Manager Template : Filename of a top-level jinja or python config template.
# Example of Google Cloud Deployment Manager template to deploy GKE Cluster can be found here https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/examples/v2/gke
gkeconfigfile: gke/demo-gke-cluster.yaml
# Properties to replace in variubales templates
# gkeproperties:
# zone: us-central1-a
# initialNodeCount: 1
Delete Cluster¶
Delete cluster will clean up the resources in Google Cloud as well.
./rctl delete cluster demo-gke-cluster --type gke --zone us-west2-a --gkeproject demo-gke