In this article, we are going to see how to create a Kubernetes Cluster into Google Container Engine. By the end of it, a user will have two node cluster up and running.
Prerequisites
In order to create a Kubernetes Cluster, a user requires at least one project in Google Cloud Platform. This allows a user to use Google Container Engine resource. After creating a project, a user gets project information on Google Console as shown in fig.(1)
Related Articles
Google cloud shell
Google Cloud Shell provides command-line access to cloud resources directly from a user’s browser so that a user can easily manage projects and resources without installing the Google Cloud SDK or other tools on their system. With Cloud Shell, a user has access to the gcloud command-line tool.
To activate Google Cloud Shell,
- Select a project from the Google Cloud Dashboard
- Click on the ‘Google Cloud Shell’ button
It should take a few minutes to provision and connect with the environment.
Afterwards, a user will see the cloud shell as shown in fig.(2)
Create Google Container Engine cluster
There are two methods to create a Cluster:
- gcloud command-line tool
- Google Cloud Platform console
1. Cluster Creation via gcloud command-line tool
Use following gcloud command to create a Cluster
To create a highly available multi-zone (one region) Kubernetes cluster on GKE, use the following command
Both the commands will help a user create a Kubernetes cluster with two nodes (one node per zone). All nodes share the same master and workload will be spread evenly across two nodes.
2. Cluster Creation via Google Cloud Platform console
Let’s create a cluster with two nodes into asia-southeast1-b zone using the console.
Go to ‘Container Engine’ page and select ‘Create a container cluster’.
A user should then see the page as shown in fig.(4). Add Cluster Name, Zone and Node Size as per the requirement.
Once a user is done entering the information, click on the ‘Create’ button. This will take a few minutes to complete.
When it’s completed, a user will see the cluster information as shown in Fig.(5)
At this point, Container Engine has created Compute Engine instances that can be viewed in the ‘VM Instances’ section as shown in fig.(6). The instances are nodes of the Container Engine cluster.
The user now has a Kubernetes cluster on Google Container Engine.
For configuring the kubectl command locally, the user has to set the default project id, zone and cluster name using the following commands
Also, fetch the cluster credentials for the kubectl tool as follows
Then start a proxy to view the Kubernetes Dashboard on the local browser
Open the Dashboard using the following URL
http://localhost:8001/ui
Get the cluster info using the following command:
Conclusion:
We have learned how to use Google Cloud Shell, turn on the relevant APIs and spun up a Kubernetes cluster on Google Container Engine. Container Engine is fully managed by Google reliability engineers, ensuring cluster is available and up-to-date, including both auto-upgrading and auto-repairing master and nodes. It can help a user automatically scale up and down his application based on the resource utilisation.
The post Kubernetes Cluster on Google Container Engine appeared first on DevOpsTech Solutions.
This post first appeared on Migrating XEN Virtual Machines To The AWS Cloud, please read the originial post: here