How to setup auto scale Kubernetes cluster in hybrid mode

6/22/2019

I need to create K8s autoscale setup for spark application which will be running - on premise and AWS both as docker images.By scale, I mean (scale up and down of nodes) from on-premise to AWS cloud using cluster autoscaler or by other means

I browsed so many articles like how to set up K8 cluster on AWS/ HPA & CA scaling but could not get concrete directions to follow

I am looking for any direction which can help me understand from where i should start/steps to follow to setup such K8s cluster.

-- Rajat
autoscaling
kubernetes

1 Answer

6/25/2019

Regarding Cluster Autoscaler: Cluster Autoscaler is a tool that automatically adjusts the size of the Kubernetes cluster when one of the following conditions is true: - there are pods that failed to run in the cluster due to insufficient resources, - there are nodes in the cluster that have been underutilized for an extended period of time and their pods can be placed on other existing nodes.

The cluster autoscaler on Azure dynamically scales Kubernetes worker nodes. It runs as a deployment in your cluster. This README will help you get cluster autoscaler running on your Azure Kubernetes cluster.

Regarding HPA: The Horizontal Pod Autoscaler automatically scales the number of pods in a replication controller, deployment or replica set based on observed CPU utilization or other custom metrics. HPA normally fetches metrics from a series of aggregated APIs: - metrics.k8s.io - custom.metrics.k8s.io - external.metrics.k8s.io

Metrics-server needs to be launched separately if you wish to base on something more than just CPU utilization. More info can be found here and here.

How to make it work? HPA is being supported by kubectl by default:

  • kubectl create - creates a new autoscaler
  • kubectl get hpa - lists your autoscalers
  • kubectl describe hpa - gets a detailed description of autoscalers
  • kubectl delete - deletes an autoscaler

Example: kubectl autoscale rs foo --min=2 --max=5 --cpu-percent=80 creates an autoscaler for replication set foo, with target CPU utilization set to 80% and the number of replicas between 2 and 5.

Here is a detailed documentation of how to use kubectl autoscale command.

-- OhHiMark
Source: StackOverflow