Automatically Start and Stop pods from a deployment at a specific time by cron annotation.
737
Another Autoscaler is a Kubernetes controller that automatically starts, stops, or restarts pods from a deployment at a specified time using a cron syntax.
Another Autoscaler read the annotation of each deployment and performs an increase or decrease in the number of replicas.
The date and time must be in UTC.
The restart feature execute a rollout restart deployment.
# Deploy Another Autoscaler into Kubernetes on default namespace
kubectl apply -f https://raw.githubusercontent.com/dignajar/another-autoscaler/master/kubernetes/full.yaml
Stop pods at 6pm every day:
another-autoscaler.io/stop-time: "00 18 * * *"
Start pods at 1pm every day:
another-autoscaler.io/start-time: "00 13 * * *"
Start 3 pods at 2:30pm every day:
another-autoscaler.io/start-time: "30 14 * * *"
another-autoscaler.io/start-replicas: "3"
Restart pods at 9:15am every day:
another-autoscaler.io/restart-time: "15 09 * * *"
Restart pods at 2:30am, only on Saturday and Sunday:
another-autoscaler.io/restart-time: "00 02 * * 0,6"
The following example start 5 replicas in total at 2pm and stop 4 of them at 3pm every day, the deployment start with 0 replicas.
The start-replicas is not incremental, the value is the number of replicas will be setup by Another Autoscaler at the defined time by start-time.
The date and time must be in UTC.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
annotations:
another-autoscaler.io/start-time: "00 14 * * *"
another-autoscaler.io/start-replicas: "5"
another-autoscaler.io/stop-time: "00 15 * * *"
another-autoscaler.io/stop-replicas: "1"
spec:
replicas: 0
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
Content type
Image
Digest
Size
25.3 MB
Last updated
about 5 years ago
docker pull dignajar/another-scheduler