Example of Horizontal Pods Autoscaler using minikube
Motivation for this project.
How to set up the environment and required tools?
Docker for Mac/Ubuntu/Windows.
This is used for creating a containerized application and pushing an image to DockerHub to access it in Kubernetes configuration. You can also use a locally built image. But it is always better to push DockerHub to have an ease of access anywhere whether locally or AWS.
for Mac, install Docker for Moc
Minikube
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day. [https://github.com/kubernetes/minikube]
for Mac, brew cask install minikube
VirtualBox
Virtual Box is used by Minikube to run a virtual machine for cluster set up purpose.
for Mac, brew cask install virtualbox
Kubectl
Kubectl is the command-line interface that lets you interact with Kuberentes. Run brew install kubectl in your Terminal.
Minikube will automatically install it as a dependency.
Steps to run the sample HPA after installing required tools.
Below steps are to setting up Minikube.
minikube start
. This command will take time on first run.kubectl version
minikube addons enable metrics-server
kubectl top node
, enabling can take few seconds, so be patientmetrics-server
doesn’t work try this step:git clone https://github.com/kubernetes-incubator/metrics-server.git
cd metrics-server
kubectl create -f deploy/1.8+/
kubectl top node
kubectl apply -f k8s
minikube dashboard
to open Kubernetes dashboardminikube service node-example
to check the node-app pod(container) is working or notwatch
if not installed using brew install watch
.watch -n 1 kubectl get pods
watch -n 1 kubectl get hpa
ab -c 5 -n 1000 -t 100000 http://192.168.99.100:30001/
. Used Apache Benchmark here.