Fix instructions to define HPA declaratively
This commit is contained in:
@@ -311,29 +311,16 @@ HorizontalPodAutoscaler.
|
|||||||
|
|
||||||
## Appendix: Other possible scenarios
|
## Appendix: Other possible scenarios
|
||||||
|
|
||||||
### Creating the autoscaler from a .yaml file
|
### Creating the autoscaler declaratively
|
||||||
|
|
||||||
Instead of using `kubectl autoscale` command we can use the [hpa-php-apache.yaml](/docs/user-guide/horizontal-pod-autoscaling/hpa-php-apache.yaml) file, which looks like this:
|
Instead of using `kubectl autoscale` command to create a HorizontalPodAutoscaler imperatively we
|
||||||
|
can use the following file to create it declaratively:
|
||||||
|
|
||||||
```yaml
|
{% include code.html language="yaml" file="hpa-php-apache.yaml" ghlink="/docs/tasks/run-application/hpa-php-apache.yaml" %}
|
||||||
apiVersion: autoscaling/v1
|
|
||||||
kind: HorizontalPodAutoscaler
|
|
||||||
metadata:
|
|
||||||
name: php-apache
|
|
||||||
namespace: default
|
|
||||||
spec:
|
|
||||||
scaleTargetRef:
|
|
||||||
apiVersion: apps/v1beta1
|
|
||||||
kind: Deployment
|
|
||||||
name: php-apache
|
|
||||||
minReplicas: 1
|
|
||||||
maxReplicas: 10
|
|
||||||
targetCPUUtilizationPercentage: 50
|
|
||||||
```
|
|
||||||
|
|
||||||
We will create the autoscaler by executing the following command:
|
We will create the autoscaler by executing the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ kubectl create -f docs/user-guide/horizontal-pod-autoscaling/hpa-php-apache.yaml
|
$ kubectl create -f https://k8s.io/docs/tasks/run-application/hpa-php-apache.yaml
|
||||||
horizontalpodautoscaler "php-apache" created
|
horizontalpodautoscaler "php-apache" created
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: autoscaling/v1
|
||||||
|
kind: HorizontalPodAutoscaler
|
||||||
|
metadata:
|
||||||
|
name: php-apache
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
scaleTargetRef:
|
||||||
|
apiVersion: apps/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
name: php-apache
|
||||||
|
minReplicas: 1
|
||||||
|
maxReplicas: 10
|
||||||
|
targetCPUUtilizationPercentage: 50
|
||||||
Reference in New Issue
Block a user