Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 3. Using the heat service for autoscaling
After you deploy the services required to provide autoscaling in the overcloud, you must configure the overcloud environment so that the Orchestration service (heat) can manage instances for autoscaling.
Prerequisites
- A deployed overcloud. For more information, see Section 2.2, “Deploying the overcloud for autoscaling”.
Procedure
3.1. Creating the generic archive policy for autoscaling Link kopierenLink in die Zwischenablage kopiert!
After you deploy the services for autoscaling in the overcloud, you must configure the overcloud environment so that the Orchestration service (heat) can manage the instances for autoscaling.
Prerequisites
- You have deployed an overcloud that has autoscaling services. For more information, see Section 2.1, “Configuring the overcloud for autoscaling”.
Procedure
-
Log in to your environment as the
stack
user. For standalone environments, set the
OS_CLOUD
environment variable:export OS_CLOUD=standalone
[stack@standalone ~]$ export OS_CLOUD=standalone
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For director environments source the
stackrc
file:source ~/stackrc
[stack@undercloud ~]$ source ~/stackrc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the archive policy defined in
$HOME/templates/autoscaling/parameters-autoscaling.yaml
:openstack metric archive-policy create generic \ --back-window 0 \ --definition timespan:'4:00:00',granularity:'0:01:00',points:240 \ --aggregation-method 'rate:mean' \ --aggregation-method 'mean'
$ openstack metric archive-policy create generic \ --back-window 0 \ --definition timespan:'4:00:00',granularity:'0:01:00',points:240 \ --aggregation-method 'rate:mean' \ --aggregation-method 'mean'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that the archive policy was created:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2. Configuring a heat template for automatically scaling instances Link kopierenLink in die Zwischenablage kopiert!
You can configure an Orchestration service (heat) template to create the instances, and configure alarms that create and scale instances when triggered.
This procedure uses example values that you must change to suit your environment.
Prerequisites
- You have deployed the overcloud with the autoscaling services. For more information, see Section 2.2, “Deploying the overcloud for autoscaling”.
- You have configured the overcloud with an archive policy for autoscaling telemetry storage. For more information, see Section 3.1, “Creating the generic archive policy for autoscaling”.
Procedure
Log in to your environment as the
stack
user.source ~/stackrc
$ source ~/stackrc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a directory to hold the instance configuration for the autoscaling group:
mkdir -p $HOME/templates/autoscaling/vnf/
$ mkdir -p $HOME/templates/autoscaling/vnf/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Create an instance configuration template, for example,
$HOME/templates/autoscaling/vnf/instance.yaml
. Add the following configuration to your
instance.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
The
parameters
parameter defines the custom parameters for this new resource. -
The
vnf
sub-parameter of theresources
parameter defines the name of the custom sub-resource referred to in theOS::Heat::AutoScalingGroup
, for example,OS::Nova::Server::VNF
.
-
The
Create the resource to reference in the heat template:
$ cat <<EOF > $HOME/templates/autoscaling/vnf/resources.yaml resource_registry: "OS::Nova::Server::VNF": $HOME/templates/autoscaling/vnf/instance.yaml EOF
$ cat <<EOF > $HOME/templates/autoscaling/vnf/resources.yaml resource_registry: "OS::Nova::Server::VNF": $HOME/templates/autoscaling/vnf/instance.yaml EOF
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the deployment template for heat to control instance scaling:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOutputs on the stack are informational and are not referenced in the ScalingPolicy or AutoScalingGroup. To view the outputs, use the
openstack stack show <stack_name>
command.
3.3. Preparing the standalone deployment for autoscaling Link kopierenLink in die Zwischenablage kopiert!
To test the deployment of a stack for an autoscaled instance in a pre-production environment, you can deploy the stack by using a standalone deployment. You can use this procedure to test the deployment with a standalone environment. In a production environment, the deployment commands are different.
Procedure
-
Log in to your environment as the
stack
user. Set the
OS_CLOUD
environment variable:export OS_CLOUD=standalone
[stack@standalone ~]$ export OS_CLOUD=standalone
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the cloud to allow deployment of a simulated VNF workload that uses the Fedora 36 cloud image with attached private and public network interfaces. This example is a working configuration that uses a standalone deployment:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the flavor:
openstack flavor create --ram 2048 --disk 10 --vcpu 2 --public m1.small
$ openstack flavor create --ram 2048 --disk 10 --vcpu 2 --public m1.small
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Download and import the Fedora 36 x86_64 cloud image:
curl -L 'https://download.fedoraproject.org/pub/fedora/linux/releases/36/Cloud/x86_64/images/Fedora-Cloud-Base-36-1.5.x86_64.qcow2' -o $HOME/fedora36.qcow2
$ curl -L 'https://download.fedoraproject.org/pub/fedora/linux/releases/36/Cloud/x86_64/images/Fedora-Cloud-Base-36-1.5.x86_64.qcow2' -o $HOME/fedora36.qcow2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow openstack image create fedora36 --container-format bare --disk-format qcow2 --public --file $HOME/fedora36.qcow2
$ openstack image create fedora36 --container-format bare --disk-format qcow2 --public --file $HOME/fedora36.qcow2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate and import the public key:
ssh-keygen -f $HOME/.ssh/id_rsa -q -N "" -t rsa -b 2048
$ ssh-keygen -f $HOME/.ssh/id_rsa -q -N "" -t rsa -b 2048
Copy to Clipboard Copied! Toggle word wrap Toggle overflow openstack keypair create --public-key $HOME/.ssh/id_rsa.pub default
$ openstack keypair create --public-key $HOME/.ssh/id_rsa.pub default
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
basic
security group that allows SSH, ICMP, and DNS protocols:openstack security group create basic
$ openstack security group create basic
Copy to Clipboard Copied! Toggle word wrap Toggle overflow openstack security group rule create basic --protocol tcp --dst-port 22:22 --remote-ip 0.0.0.0/0
$ openstack security group rule create basic --protocol tcp --dst-port 22:22 --remote-ip 0.0.0.0/0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow openstack security group rule create --protocol icmp basic
$ openstack security group rule create --protocol icmp basic
Copy to Clipboard Copied! Toggle word wrap Toggle overflow openstack security group rule create --protocol udp --dst-port 53:53 basic
$ openstack security group rule create --protocol udp --dst-port 53:53 basic
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the external network (public):
openstack network create --external --provider-physical-network datacentre --provider-network-type flat public
$ openstack network create --external --provider-physical-network datacentre --provider-network-type flat public
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the private network:
openstack network create --internal private
$ openstack network create --internal private
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow openstack subnet create private-net \ --subnet-range $PRIVATE_NETWORK_CIDR \ --network private
$ openstack subnet create private-net \ --subnet-range $PRIVATE_NETWORK_CIDR \ --network private
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the router:
openstack router create vrouter
$ openstack router create vrouter
Copy to Clipboard Copied! Toggle word wrap Toggle overflow openstack router set vrouter --external-gateway public
$ openstack router set vrouter --external-gateway public
Copy to Clipboard Copied! Toggle word wrap Toggle overflow openstack router add subnet vrouter private-net
$ openstack router add subnet vrouter private-net
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional resources
3.4. Creating the stack deployment for autoscaling Link kopierenLink in die Zwischenablage kopiert!
Create the stack deployment for the worked VNF autoscaling example.
Procedure
Create the stack:
openstack stack create \ -t $HOME/templates/autoscaling/vnf/template.yaml \ -e $HOME/templates/autoscaling/vnf/resources.yaml \ vnf
$ openstack stack create \ -t $HOME/templates/autoscaling/vnf/template.yaml \ -e $HOME/templates/autoscaling/vnf/resources.yaml \ vnf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that the stack was created successfully:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the stack resources were created, including alarms, scaling policies, and the autoscaling group:
export STACK_ID=$(openstack stack show vnf -c id -f value)
$ export STACK_ID=$(openstack stack show vnf -c id -f value)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that an instance was launched by the stack creation:
openstack server list --long | grep $STACK_ID
$ openstack server list --long | grep $STACK_ID | 62e1b27c-8d9d-44a5-a0f0-80e7e6d437c7 | vn-dvaxcqb-6bqh2qd2fpif-hicmkm5dzjug-vnf-ywrydc5wqjjc | ACTIVE | None | Running | private=192.168.100.61, 192.168.25.99 | fedora36 | a6aa7b11-1b99-4c62-a43b-d0b7c77f4b72 | m1.small | 5cd46fec-50c2-43d5-89e8-ed3fa7660852 | nova | standalone-80.localdomain | metering.server_group='cb082cbd-535e-4779-84b0-98925e103f5e' |
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the alarms were created for the stack:
List the alarm IDs. The state of the alarms might reside in the
insufficient data
state for a period of time. The minimal period of time is the polling interval of the data collection and data storage granularity setting:Copy to Clipboard Copied! Toggle word wrap Toggle overflow List the resources for the stack and note the
physical_resource_id
values for thecpu_alarm_high
andcpu_alarm_low
resources.Copy to Clipboard Copied! Toggle word wrap Toggle overflow The value of the
physical_resource_id
must match thealarm_id
in the output of theopenstack alarm list
command.
Verify that metric resources exist for the stack. Set the value of the
server_group
query to the stack ID:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that measurements exist for the instance resources created through the stack:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow