Hosted Kubernetes Cluster
Learn how we can create a Kubernetes cluster on the cloud.
We'll cover the following
This option costs money. Be sure you understand the costs before you create this cluster. We also recommend you delete it as soon as you finish using it.
All the major cloud platforms offer a hosted Kubernetes service. This is a model where the cloud provider builds the cluster and manages things such as high availability (HA), performance, and updates.
Not all hosted Kubernetes services are equal, but they’re usually as close as you’ll get to a zero-effort production-grade Kubernetes cluster. For example, Google Kubernetes Engine (GKE) is a hosted service that creates high-performance, highly-available clusters that implement security best practices out of the box. All with just a few simple clicks and your credit card details.
Other popular hosted Kubernetes services include:
AWS: Elastic Kubernetes Service (EKS)
Azure: Azure Kubernetes Service (AKS)
Civo Cloud Kubernetes
DigitalOcean: DigitalOcean Kubernetes (DOKS)
Google Cloud Platform: Google Kubernetes Engine (GKE)
Linode: Linode Kubernetes Engine (LKE)
We’ll create a GKE cluster, and you’ll complete all of the following steps:
GKE pre-requisites
Create a GKE cluster
Test your GKE cluster
GKE pre-requisites
GKE is a hosted Kubernetes service on the Google Cloud Platform (GCP). Like most hosted Kubernetes services, it provides:
A fast and easy way to get a production-grade cluster
A managed control plane
Itemized billing
Integration with additional services such as load balancers, volumes, service meshes, and more
To build a GKE cluster, you’ll need a Google Cloud account with billing configured and a blank project. These are simple to set up, and the remainder of this section assumes you already have them.
You’ll also need the gcloud
CLI. Go to https://cloud.google.com/sdk/
, click the "Get started" button, and follow the instructions to install the version for your platform. The installer will automatically install the kubectl
command line utility. As part of the installation, you’ll be prompted to run a gcloud auth login
command to authorize access to your Google Cloud project. This will open a browser session, and you need to follow and accept the prompts.
Create a GKE cluster
Once you’ve got a new Google Cloud project and installed the gcloud CLI, complete the following steps to create a new GKE cluster.
Go to
https://console.cloud.google.com/
and select Kubernetes Engine > Clusters from the navigation pane on the left. You may need to click the three horizontal bars (hamburger) in the top left corner to make the navigation pane visible.Select the option to create a cluster and then choose the option to SWITCH TO STANDARD CLUSTER. Do not create an AutoPilot cluster, as these don’t currently work with all examples. You’ll be prompted to confirm you want to switch from autopilot to standard.
Give your cluster a meaningful name. The examples in the course will use gke-tkb.
Choose a Regional cluster in the Location type. Some of the examples later in the course will only work with regional clusters. The course assumes your cluster is located in
us-central1
region. If you wish to change the region, kindly change the region in the commands as well.Select a Region for your cluster.
Click Target Release channel and select the latest version from the Rapid channel.
Click default-pool from the left navigation menu and set Number of nodes (per zone) to 1 in the Size section.
Feel free to explore other settings. However, do not change any of them as they might impact the examples later in the course.
Once you’re happy with your configuration and the estimated monthly cost, click Create.
It’ll take a couple of minutes to create your cluster.
Test your GKE cluster
The clusters page of your Google Cloud Console shows a high-level overview of the Kubernetes clusters in your project. Feel free to poke around and familiarize yourself with some of the settings.
Click the three dots to the right of your new cluster to reveal the Connect option. The command-line access section gives you a long gcloud
command to configure kubectl
to talk to your cluster.
Copy the command to your clipboard and run it in the terminal.
Get hands-on with 1400+ tech skills courses.