GCP GKE - Cluster provisioning
This example demonstrates provisioning a Google Kubernetes Engine (GKE) cluster on the GCP cloud. The deployment consists of:
- GCP GKE cluster
- Security Group
- All of the essential peripherals in GCP (IP address, NIC, etc…).
In this example we will deploy only the cluster. Later, in the more advanced examples (multi cloud examples) we will leverage this setup as the basis for deploying a containerized service.
This example expects the following prerequisites:
- A Cloudify Manager installed and accessible.
- Access to GCP infrastructure is required to demonstrate this example.
Cloudify CLI or Cloudify Management Console?
Cloudify allows for multiple user interfaces. Some users find the Cloudify Management Console (web based UI) more intuitive while others prefer the Cloudify CLI (Command Line Interface). This tutorial and all following ones will describe both methods.
Community version - Some of the options described in the guide are not available in the community version management console (web UI). An example would be setting up secrets. You can still perform all of the functionality using the Cloudify CLI.
Cloudify Management Console
This section explains how to run the above described steps using the Cloudify Management Console. The Cloudify Management Console and Cloudify CLI can be used interchangeably for all Cloudify activities.
Import Plugins and Secrets
To connect to GCP, credentials and Cloudify plugins are required. Cloudify recommends storing such sensitive information in a Cloudify secret. Secrets are kept encrypted in a secure way and used in run-time by the system. Learn more about Cloudify secrets here.
GCP credentials can be created by following the guide here.
To store the access keys as secrets in the Cloudify Manager, login to the Cloudify Management Console and select the Resources page. In the Secrets panel, scroll to the Secret Store Management widget and use the Create button to add the following new secret:
To view the imported secrets in the Cloudify Manager, login to the Cloudify Management Console and select the Resources page and navigate to the Secrets tab. The following secrets should exist after following the above steps:
To view the imported plugins in the Cloudify Manager, login to the Cloudify Management Console and select the Resources page and navigate to the Plugins tab. The following plugins should exist after following the above steps:
Import Kubernetes Blueprint
The Cloudify Manager provides an easy method of provisioning a Kuberenetes cluster on GCP GKE. On the Marketplace page, navigate to the Kubernetes Blueprint Examples tab and upload the Kubernetes-GCP-GKE blueprint.
Once imported, you can find the resulting Kubernetes-GCP-GKE blueprint by clicking on the Blueprints page.
Deploy an GCP GKE Cluster
On the Blueprints page, click the Create deployment button for the Kubernetes-GCP-GKE blueprint.
- Create a Deployment name.
- Adjust the Zone input to match your preferences.
Click the Deploy & Install button at the bottom of the form to start the deployment. On the following page, click the Execute button.
You now have a Cloudify Deployment running the default install workflow. Cloudify will begin actively interfacing with GCP to deploy a GCP GKE Kubernetes cluster. You can track the status of the Deployment in the Execution Task Graph panel in the Deployments page.
Using the GCP GKE Cluster
Install CLI tools
GCP documentation: https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html
GCP documentation: https://cloud.google.com/sdk/docs/install
To initialize Kubectl, go to the GCP Console, navigate to the Kubernetes Engine page and in the dropdown for your cluster, click Connect. This will display a CLI command to use to setup the Kubectl config.
# Example GKE Kubectl init command gcloud container clusters get-credentials ex2-cluster --zone europe-central2-a --project eaas-266314
# List version kubectl version --kubeconfig ~/.kube/config # List namespaces kubectl get ns --kubeconfig ~/.kube/config # List nodes kubectl get nodes --kubeconfig ~/.kube/config