Skip to content

Commit

Permalink
kubernetes-resume-challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
TomiwaAribisala-git committed Mar 21, 2024
1 parent 7ae3f66 commit 14cadad
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,7 @@ jobs:
kubectl apply -f ecom-web-configmap.yml
kubectl apply -f ecom-web-config.yml
kubectl apply -f ecom-web.yml
kubectl apply -f ecom-web-svc.yml
kubectl apply -f ecom-web-svc.yml
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
kubectl apply -f php-apache-svc.yml
kubectl apply -f php-apache.yml
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,12 @@ docker run -d —network some-network —name ecom-web -p 8080:80 ecom-web:v1

![Rollback-Update](./images/rollback.png)

![Wesbite-Rollback-Update](./images/website-rollback.png)
![Wesbite-Rollback-Update](./images/website-rollback.png)

## Autoscaling the application based on CPU usage to handle unpredictable traffic spikes
- Installed Kubernetes Metrics Server: `kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml`
- Created a [HorizontalPodAutoscaler Deployment](./kubernetes/php-apache.yml) and [HorizontalPodAutoscaler Service](./kubernetes/php-apache-svc.yml)

## Extras
- [HorizontalPodAutoscaler Walkthrough](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/)
- [Kubernetes Metrics Server](https://github.com/kubernetes-sigs/metrics-server)
8 changes: 8 additions & 0 deletions kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,12 @@ kubectl apply -f ecom-web.yml

```sh
kubectl apply -f ecom-web-svc.yml
```

```sh
kubectl apply -f php-apache-svc.yml
```

```sh
kubectl apply -f php-apache.yml
```
23 changes: 23 additions & 0 deletions kubernetes/php-apache-svc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: php-apache
spec:
selector:
matchLabels:
run: php-apache
template:
metadata:
labels:
run: php-apache
spec:
containers:
- name: php-apache
image: registry.k8s.io/hpa-example
ports:
- containerPort: 80
resources:
limits:
cpu: 500m
requests:
cpu: 200m
11 changes: 11 additions & 0 deletions kubernetes/php-apache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: php-apache
labels:
run: php-apache
spec:
ports:
- port: 80
selector:
run: php-apache

0 comments on commit 14cadad

Please sign in to comment.