[Kubernetes] Creating Testing Environment with Cloud VMs

4 min readJan 29, 2021

One of my previous blogs, I showed how to start with Play with Kubernetes platform to deploy simple Kubernetes cluster as well as running a simple web application within.

The Play with Kubernetes platform is great to learn how to set up the environment perspective; however, it is not ideal for continuous testing lab purposes since it expires.

Cloud VM Spec

  • VM OS: Ubuntu 18.04
  • Size: 2 Virtual CPU, 4 GiB Memory

Note: To run kubeadm, a minimum of two (2) CPU is required

We will create three (3) VMs with the same spec:

  • VM 1 — Master Node
  • VM 2 — Worker Node 1
  • VM 3 — Worker Node 2

I will skip how to create cloud VMs in this post, but it does not matter which cloud platform you choose as long as the VMs meet the above spec.

Install Commands #1 (Run these in all 3 VMs)

1–1) Login

Log into the cloud VMs and escalate to root.

1-2) Add GPG key for Docker Repository

# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -OK

1-3) Add Docker Repository

# sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"Hit:1 http://us-west-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://us-west-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://us-west-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:5 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Get:6 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [15.4 kB]
Fetched 169 kB in 3s (51.0 kB/s)
Reading package lists... Done

1-4) Reload the apt Source List

# sudo apt-get update

OSWE | OSCE | OSCP | CREST | Lead Offensive Security Engineer — All about Penetration Test, Red Team, Cloud Security, Web Application Security