Skip to content

Commit

Permalink
keda example specific day
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa6765 committed Nov 30, 2024
0 parents commit 8421340
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 0 deletions.
6 changes: 6 additions & 0 deletions READEME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# install keda
```bash
helm repo add kedacore https://kedacore.github.io/charts
helm repo update
helm install keda kedacore/keda --namespace keda --create-namespace
```
16 changes: 16 additions & 0 deletions scale-specific-day-time/READEME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# apply manifest
```bash
kubectl apply -f manifest/namespace.yml
kubectl apply -f manifest/deployment.yaml
kubectl apply -f manifest/nginx-scaler.yaml
# or run script
./run.sh
```

# check keda
```bash
kubectl get scaledobjects -n backend-project
kubectl get pods -n backend-project -w
```


22 changes: 22 additions & 0 deletions scale-specific-day-time/manifest/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-app
namespace: backend-project
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
4 changes: 4 additions & 0 deletions scale-specific-day-time/manifest/namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: backend-project
19 changes: 19 additions & 0 deletions scale-specific-day-time/manifest/nginx-scaler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: nginx-scaler
namespace: backend-project
spec:
scaleTargetRef:
name: nginx-app
minReplicaCount: 2
maxReplicaCount: 10
pollingInterval: 15
cooldownPeriod: 10
triggers:
- type: cron
metadata:
timezone: "Asia/Dhaka"
start: "40 22 * * 6" # 10:40 PM || Saturday
end: "45 22 * * 6" # 10:45 PM || Saturday
desiredReplicas: "8"
3 changes: 3 additions & 0 deletions scale-specific-day-time/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kubectl apply -f manifest/namespace.yml
kubectl apply -f manifest/deployment.yaml
kubectl apply -f manifest/nginx-scaler.yaml

0 comments on commit 8421340

Please sign in to comment.