mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
97 lines
2.4 KiB
Plaintext
97 lines
2.4 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * hosted_control_planes/hcp-manage/hcp-manage-openstack.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="hcp-openstack-autoscale_{context}"]
|
|
= Enabling node auto-scaling for the hosted cluster
|
|
|
|
When you need more capacity in your hosted cluster on {rh-openstack-first} and spare agents are available, you can enable auto-scaling to install new worker nodes.
|
|
|
|
.Procedure
|
|
|
|
. To enable auto-scaling, enter the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc -n <hosted_cluster_namespace> patch nodepool <hosted_cluster_name> \
|
|
--type=json \
|
|
-p '[{"op": "remove", "path": "/spec/replicas"},{"op":"add", "path": "/spec/autoScaling", "value": { "max": 5, "min": 2 }}]'
|
|
----
|
|
|
|
. Create a workload that requires a new node.
|
|
|
|
.. Create a YAML file that contains the workload configuration, by using the following example:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
app: reversewords
|
|
name: reversewords
|
|
namespace: default
|
|
spec:
|
|
replicas: 40
|
|
selector:
|
|
matchLabels:
|
|
app: reversewords
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: reversewords
|
|
spec:
|
|
containers:
|
|
- image: quay.io/mavazque/reversewords:latest
|
|
name: reversewords
|
|
resources:
|
|
requests:
|
|
memory: 2Gi
|
|
----
|
|
|
|
.. Save the file with the name `workload-config.yaml`.
|
|
|
|
.. Apply the YAML by entering the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f workload-config.yaml
|
|
----
|
|
|
|
. Extract the `admin-kubeconfig` secret by entering the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc extract -n <hosted_cluster_namespace> \
|
|
secret/<hosted_cluster_name>-admin-kubeconfig \
|
|
--to=./hostedcluster-secrets --confirm
|
|
----
|
|
+
|
|
.Example output
|
|
----
|
|
hostedcluster-secrets/kubeconfig
|
|
----
|
|
|
|
. You can check if new nodes are in the `Ready` status by entering the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc --kubeconfig ./hostedcluster-secrets get nodes
|
|
----
|
|
|
|
. To remove the node, delete the workload by entering the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc --kubeconfig ./hostedcluster-secrets -n <namespace> \
|
|
delete deployment <deployment_name>
|
|
----
|
|
|
|
. Wait for several minutes to pass without requiring the additional capacity. You can confirm that the node was removed by entering the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc --kubeconfig ./hostedcluster-secrets get nodes
|
|
----
|