How to use Kubernetes on GCP
What will you learn:-
What is Kubernetes
Kubernetes, aka, K8s is an open-source system for automating deployment, scaling, and managing containerized applications. It handles the work of scheduling containers onto a compute cluster and manages the workloads to ensure they run as the user intends.
It has two major components:-
Using Kubernetes on GCP
GCP provides a managed and secured Kubernetes service called GKE (Google Kubernetes Engine) to create and maintain k8s clusters. GKE is GCP’s enterprise-grade platform to deploy containerized applications and services on kubernetes clusters.
Key Features of GKE:
- 1. Enterprise-ready Kubernetes applications are directly available for deployment from Google Marketplace.
- 2. Cluster auto-scaling as well as Horizontal and Vertical Pod auto-scaling based on changing workload requirements.
- 3. Workload and network security provided by GKE sandbox as a second layer of defense between containerized workloads in addition to supporting the native Kubernetes Network Policy
Check out all the features provided by GKE here.
Cluster Creation on GKE:
Follow the steps below to create a cluster using GKE console:
- Go to https://console.cloud.google.com/kubernetes/ to access the GKE console.
- Click the Create Cluster button.
In the Cluster basics section, complete the following:
- a. Enter the Name for your cluster. ( e.g. my-first-cluster )
- b. For the Location type, select Zonal, and then select the desired zone for your cluster. ( e.g. us-central1-c)
- c. Choose a Master Version. Let’s go with the default selection for “Static version” for now. (which is 1.14.10-gke.24 as of writing this article)
From the navigation pane, under Node Pools, click default-pool.
- a. Enter a Name for the default Node pool. (e.g. my-default-pool)
- b. Choose the Node version for your nodes. (Let’s leave it to the default value which is 1.14.10-gke.24 as of this writing)
- c. Enter the Number of nodes to create in the cluster. (Let’s have 4 nodes)
- d. Leave other options as default.
- From the navigation pane, under Node Pools, click Nodes.
- From the Image type drop-down list, select the desired node image. Let’s leave it to default which is Container-Optimized OS or “cos” as of this writing. You can read more about Node images on GKE here.
- Choose the default Machine configuration to use for the instances. Read here for comparison of different machine types and the recommended types for different use cases.
- The default machine type is n1-standard-1. Each machine type is billed differently. For machine type pricing information, refer to the machine type price sheet.
- From the Boot disk type drop-down list, select the desired disk type.
- Enter the Boot disk size.
- Leave other fields as default and Click Create.
- After a few minutes, you will have your first k8s cluster running with your chosen configuration.