Skip to content

Commit dc788d1

Browse files
authored
Merge pull request kubernetes#6545 from surajssd/fix-hpa-declarative-instructions
Fix instructions to define HPA declaratively
2 parents 34ca17e + 8ad19e8 commit dc788d1

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

docs/tasks/run-application/horizontal-pod-autoscale-walkthrough.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -311,29 +311,16 @@ HorizontalPodAutoscaler.
311311

312312
## Appendix: Other possible scenarios
313313

314-
### Creating the autoscaler from a .yaml file
314+
### Creating the autoscaler declaratively
315315

316-
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:
316+
Instead of using `kubectl autoscale` command to create a HorizontalPodAutoscaler imperatively we
317+
can use the following file to create it declaratively:
317318

318-
```yaml
319-
apiVersion: autoscaling/v1
320-
kind: HorizontalPodAutoscaler
321-
metadata:
322-
name: php-apache
323-
namespace: default
324-
spec:
325-
scaleTargetRef:
326-
apiVersion: apps/v1beta1
327-
kind: Deployment
328-
name: php-apache
329-
minReplicas: 1
330-
maxReplicas: 10
331-
targetCPUUtilizationPercentage: 50
332-
```
319+
{% include code.html language="yaml" file="hpa-php-apache.yaml" ghlink="/docs/tasks/run-application/hpa-php-apache.yaml" %}
333320

334321
We will create the autoscaler by executing the following command:
335322

336323
```shell
337-
$ kubectl create -f docs/user-guide/horizontal-pod-autoscaling/hpa-php-apache.yaml
324+
$ kubectl create -f https://k8s.io/docs/tasks/run-application/hpa-php-apache.yaml
338325
horizontalpodautoscaler "php-apache" created
339326
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: autoscaling/v1
2+
kind: HorizontalPodAutoscaler
3+
metadata:
4+
name: php-apache
5+
namespace: default
6+
spec:
7+
scaleTargetRef:
8+
apiVersion: apps/v1beta1
9+
kind: Deployment
10+
name: php-apache
11+
minReplicas: 1
12+
maxReplicas: 10
13+
targetCPUUtilizationPercentage: 50

0 commit comments

Comments
 (0)