Automated Kubernetes Cluster Creation on GCP Using Kubeadm

Vinayak Pandey
2 min readApr 13, 2021

Recently I got a couple of assignments to complete as part of screening process for Kubernetes Engineer role. Tasks for Level1 assignment are listed below:

1. Create a Kubernetes cluster on GCP.
2. Install nginx ingress controller on the cluster.
3. On this cluster, create namespaces called staging and production.
4. Install guest-book application on both namespaces.
5. Expose staging application on hostname staging-guestbook.mstakx.io
6. Expose production application on hostname guestbook.mstakx.io
7. Implement a pod autoscaler on both namespaces which will scale frontend pod replicas up and down
based on CPU utilization of pods.

Solution: You can download the solution from https://github.com/vinycoolguy2015/awslambda/blob/master/GCP_Kubernetes_Assignment1.zip.

Unzip the downloaded file and change GCP project name in Makefile. After that just execute make create-kubernetes-cluster command. This will create a 3 node cluster(1 master and 2 slave) and deploy the application in their respective namespace.

Once done,make host entries for staging-guestbook.mstakx.io and guestbook.mstakx.io(use one of the node’s ip as we have exposed our ingress controller as NodePort service).

Now we’ll test pod autoscaling. So run the given commands to test our pod autoscaling.

yum install -y httpd-tools and ab -n 500000 -c 1000 http://guestbook.mstakx.io:30000/
kubectl get hpa -n production — watch

That’ all for this problem statement. In some other post, we’ll see the Level2 problem statement and solution of this assigment.

--

--