You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.2 KiB
Markdown

## Scale workload to match demand
Horizontal scaling means that the response to increased load is to deploy more Pods.
#### 1. Setup a server-side web app
We will deploy a simple php webapp that performs the sum of all square roots from 0 to 100000.
Therefore, you must complete the following manifest :
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: simple-hpa-app
spec:
template:
metadata:
name: app
spec:
containers:
- name: php-apache
image: php:7.2-apache
```
You will need to mount the following `index.php` file to `/var/www/html` (preferably as a configmap).
```php
<?php
$x = 0.0001;
for ($i = 0; $i <= 1000000; $i++) {
$x += sqrt($x);
}
echo "OK! Sum is $x";
?>
```
This script is very simple but it can also be quite intense to compute when forked multiple times.
#### 2. Set compute requirements
You will update the deployment in order to define CPU requirements for each pods. They allow to both reserve and limit the amount of compute resources used by each pod.
Set the correct values so that each pod c i always between `200m` and `500m`
> It is also possible to set RAM requirements
#### 3. Testing
This