https://github.com/arjunrn/simple-scaler
Alternate pod autoscaler implementation
https://github.com/arjunrn/simple-scaler
autoscaling kubernetes pod
Last synced: about 1 year ago
JSON representation
Alternate pod autoscaler implementation
- Host: GitHub
- URL: https://github.com/arjunrn/simple-scaler
- Owner: arjunrn
- License: mit
- Created: 2018-12-03T16:33:16.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-02-15T11:48:39.000Z (over 5 years ago)
- Last Synced: 2025-03-29T08:51:13.082Z (about 1 year ago)
- Topics: autoscaling, kubernetes, pod
- Language: Go
- Size: 83 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Basic Kubernetes Pod Autoscaler
The default Horizontal Pod Autoscaler has several shortcomings which can be listed as follows:
1. The scaling is not restricted in terms of how pods are started and stopped at the same time.
2. The scaling action is not based on historical data but on current usage.
3. The thresholds for scaling up and scaling down are the same.
## Usage
Create a scaler object in the following format:
```yaml
apiVersion: arjunnaik.in/v1alpha1
kind: Scaler
metadata:
name: example-scaler
namespace: default
spec:
evaluations: 2 // Number of evaluations in before scaling happens
minReplicas: 1 // Minimum number of replicas
maxReplicas: 10 // Maximum number of replicas
scaleUp: 50 // Scale Up threshold in utilization percentage
scaleDown: 20 // Scale Down threshold in utilization percentage
scaleUpSize: 2 // Number of pods to scale up
scaleDownSize: 1 // Number of pods to scale down
target:
kind: Deployment
name: nginx
apiVersion: apps/v1
```
In the above example the `target` field contains the scaling target. In this case the target is a _Deployment_ with
the name `nginx`. Evaluations indicates the number of minutes _(cycles)_ before scaling happens. In this example,
if the CPU utilization of a pod is more than _50%_ for more than 2 minutes then the deployment is scaled up. The
`scaleUpSize` and `scaleDownSize` indicates the number of pods to be increased on successful scale up or scale down
evaluations.
## Dependencies
This setup expects Prometheus to be running in the cluster and configured to scrape pod resource metrics. The address
for Prometheus can be passed through `-prometheus-url` flag.