In this article, I will share how to deploy a mini Kubernetes cluster on the GCP virtual machine (VM). We select the minimum requirement VM here due to the limited cost. Let’s start now.
GCP
VM instance detail
- Machine type: e2-small (2 vCPUs, 2 GB memory)
- CPU: Intel Broadwell
- IP: Prefer static
- Size: 40 GB
- Image: ubuntu-1604
VPC network rule
- Allow 80 and 443
Instance system monitoring after deploying the microk8s.
Microk8s
See it on the home page and GitHub
It’s the smallest, fastest Kubernetes from Ubuntu. I can deploy it on the e2-small VM and it works perfectly for a mini project (at least for me).
Before start installing microk8s, make sure snap
library is installed in Ubuntu. If not found, please check it here.
1.Install microk8s
sudo snap install microk8s --classic
2.Check the status
microk8s status --wait-ready
Notice: You will see the following information. If it doesn’t respond for a long period (such as over 5 minutes), you can terminate it and run microk8s inspect
to check the log.
3. Turn on embedded services
Here I choose to only turn dns
service to make sure it can work without overloading.
microk8s enable dns
You can also check all available services by this command microk8s enable --help
4. Set alias (optional)
snap alias microk8s.kubectl kubectl
5. Plugins (optional)
We recommend k9s
monitoring and manage the Kubernetes node.
See more details about k9s
, please visit the GitHub page.