Find out how to deploy a Kubernetes cluster to the Google Cloud Platform using the gcloud command.
If your cloud solution runs through the Google Cloud Platform and you happen to prefer managing everything from the command line, you might have installed the Google Cloud SDK on Linux. This software development kit includes the gcloud command, which allows you to interact with your Google Cloud Platform account.
By way of that interaction, you can deploy a complete Kubernetes cluster. And that's exactly what I'm going to show you.
SEE: Hybrid cloud: A guide for IT pros (TechRepublic download)
What you'll need
The only things you'll need to make this work are:
- A Google Cloud Platform account
- The Google Cloud SDK installed on a Linux machine
Before we get to the commands, there are a few terms to understand.
- Compute zones are locations within a region. For example, you can deploy in us-east1, us-east1-b, us-east1-c, or us-east1-d. For a complete list of zones, see this page.
- Types of clusters: Zonal clusters run in one or more compute zones within a region. Regional clusters run three cluster masters across three compute zones and runs nodes in two or more compute zones. Private clusters are either a zonal or regional cluster which hides both master and nodes from the public. Alpha clusters are an experimental zonal or regional cluster that run with Kubernetes alpha features enabled.
- Cluster templates are templates that make deploying clusters easier. You can select from standard cluster, Your First Cluster, CPU-Intensive applications, Memory-Intensive applications, GPU Accelerated Computing, and Highly Available.
How to deploy your first cluster
We're going to deploy a zonal cluster (in us-central1-a) using the Standard template, which is the default. The command for this would be:
gcloud container clusters create NAME --zone us-central1-a
Where NAME is a lower case, human-readable name for the cluster. You may or may not see warnings as the cluster is being deployed (Figure A).
When the command completes, it will report to you that the cluster has been created and include information like the master IP, machine type, and more (Figure B)
There are, of course, a very large number of options that can be used with the gcloud command such as --additional-zones, --default-max-pods-per-node, --disk-size, --node-locations, --enable-autoscaling, and much more. For a complete list of options, take a look at the clusters create information page.
How to delete a cluster
You might have deployed a cluster for testing purposes or have no need for a particular cluster. If that's the case, you can always delete a cluster with the command:
gcloud container clusters delete NAME --zone ZONE
Where NAME is the name of the deployed cluster and ZONE is the name of the zone.
If you're not sure of the cluster name, issue the command:
gcloud container clusters list
The above command will list out all clusters you have deployed (Figure C).
Upon issuing the command, you must confirm the deletion (Figure D).
The action will take some time. Once the action completes, your cluster is gone and you can start all over, if necessary.
And that's the gist of deploying a cluster using the gcloud command.
- Multicloud: A cheat sheet (TechRepublic)
- Serverless computing: A guide for IT leaders (TechRepublic Premium)
- What is Kubernetes? (TechRepublic)
- How to deploy a Kubernetes cluster on the Google Cloud Platform (TechRepublic)
- How to install Google Cloud SDK on Linux for easy remote access to your Google Cloud Platform (TechRepublic)
- How to deploy the Kubernetes WebUI with MicroK8s (TechRepublic)
- How to deploy a Kubernetes cluster on Ubuntu server (TechRepublic)
- Kubernetes' next step could be to try orchestrating everything else (ZDNet)
- Best cloud services for small businesses (CNET)
- Microsoft Office vs Google Docs Suite vs LibreOffice (Download.com)
- Cloud computing: More must-read coverage (TechRepublic on Flipboard)