I have a node auto-scaling shell script which takes care of auto-scaling the worker nodes based on the average CPU/memory of all the nodes in the Kubernetes
cluster.
I currently run this script from a bastion where I have the pks
, kubectl
cli installed and have also configured a cron-job to run it every 5 minutes.
Is there any other way to do this in Kubernetes
( PKS
on AWS) ?
Or may be without using a cron-job, as the auto-scaling becomes completely dependent on the cron
.
Thanks
If you mean EKS on AWS than there are different auto-scaling options
k8s
To setup autoscaling on k8s
use:
kubectl autoscale -f <controller>.yaml --min=3 --max=5
You mentioned PKS
Using PKS
over AWS
infrastructure seems as overkill. Just because AWS
has EKS
To work with AWS
cloud, VMware recommends VMC on AWS
PKS
autoscaleIf you do insist to use PKS
over AWS
, you may try this sample repo: pks-autoscale
Author of the repo also has great PKS
quickstart guide for aws
AWS
EKS
autoscalingAWS
EKS
supports three-dimensional scaling:
- Cluster Autoscaler — The Kubernetes Cluster Autoscaler automatically adjusts the number of nodes in your cluster when pods fail to launch due to lack of resources or when nodes in the cluster are underutilized and their pods can be rescheduled on to other nodes in the cluster.
- Horizontal Pod Autoscaler — The Kubernetes Horizontal Pod Autoscaler automatically scales the number of pods in a deployment, replication controller, or replica set based on that resource's CPU utilization.
- Vertical Pod Autoscaler — The Kubernetes Vertical Pod Autoscaler automatically adjusts the CPU and memory reservations for your pods to help "right size" your applications. This can help you to better use your cluster resources and free up CPU and memory for other pods.
EC2
Auto ScalingIf you decided to build your own k8s
cluster using PKS
, you may use EC2
auto scaling - just create an Auto Scaling Group.
Using aws-cli
:
aws autoscaling create-auto-scaling-group --auto-scaling-group-name <my-asg> --launch-configuration-name <my-launch-config> --min-size 3 --max-size 5 --vpc-zone-identifier "<zones>
EC2
predictive scalingRecently, AWS introduced predictive scaling for EC2:
... predictive scaling. Using data collected from your actual EC2 usage and further informed by billions of data points drawn from our own observations, we use well-trained Machine Learning models to predict your expected traffic (and EC2 usage) including daily and weekly patterns.