1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 09:46:53 +01:00
Files
openshift-docs/modules/installation-osp-setting-worker-affinity.adoc

115 lines
4.6 KiB
Plaintext

// Module included in the following assemblies:
//
// * installing/installing_openstack/installing-openstack-installer.adoc
// * installing/installing_openstack/installing-openstack-installer-custom.adoc
// * installing/installing_openstack/installing-openstack-installer-restricted.adoc
// * installing/installing_openstack/installing-openstack-user.adoc
:_mod-docs-content-type: PROCEDURE
[id="installation-osp-setting-worker-affinity_{context}"]
= Setting compute machine affinity
Optionally, you can set the affinity policy for compute machines during installation. By default, both compute and control plane machines are created with a `soft-anti-affinity` policy.
You can also create compute machine sets that use particular {rh-openstack} server groups after installation.
[TIP]
====
You can learn more about link:https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.1/html/configuring_the_compute_service_for_instance_creation/assembly_configuring-instance-scheduling-and-placement_scheduling-and-placement[{rh-openstack} instance scheduling and placement] in the {rh-openstack} documentation.
====
.Prerequisites
* Create the `install-config.yaml` file and complete any modifications to it.
.Procedure
. Using the {rh-openstack} command-line interface, create a server group for your compute machines. For example:
+
[source,terminal]
----
$ openstack \
--os-compute-api-version=2.15 \
server group create \
--policy anti-affinity \
my-openshift-worker-group
----
+
For more information, see the link:https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/15/html/command_line_interface_reference/server#server_group_create[`server group create` command documentation].
. Change to the directory that contains the installation program and create the manifests:
+
[source,terminal]
----
$ ./openshift-install create manifests --dir <installation_directory>
----
+
where:
+
`installation_directory` :: Specifies the name of the directory that contains the `install-config.yaml` file for your cluster.
. Open `manifests/99_openshift-cluster-api_worker-machineset-0.yaml`, the `MachineSet` definition file.
. Add the property `serverGroupID` to the definition beneath the `spec.template.spec.providerSpec.value` property. For example:
+
[source,yaml]
----
apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
metadata:
labels:
machine.openshift.io/cluster-api-cluster: <infrastructure_ID>
machine.openshift.io/cluster-api-machine-role: <node_role>
machine.openshift.io/cluster-api-machine-type: <node_role>
name: <infrastructure_ID>-<node_role>
namespace: openshift-machine-api
spec:
replicas: <number_of_replicas>
selector:
matchLabels:
machine.openshift.io/cluster-api-cluster: <infrastructure_ID>
machine.openshift.io/cluster-api-machineset: <infrastructure_ID>-<node_role>
template:
metadata:
labels:
machine.openshift.io/cluster-api-cluster: <infrastructure_ID>
machine.openshift.io/cluster-api-machine-role: <node_role>
machine.openshift.io/cluster-api-machine-type: <node_role>
machine.openshift.io/cluster-api-machineset: <infrastructure_ID>-<node_role>
spec:
providerSpec:
value:
apiVersion: openstackproviderconfig.openshift.io/v1alpha1
cloudName: openstack
cloudsSecret:
name: openstack-cloud-credentials
namespace: openshift-machine-api
flavor: <nova_flavor>
image: <glance_image_name_or_location>
serverGroupID: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee <1>
kind: OpenstackProviderSpec
networks:
- filter: {}
subnets:
- filter:
name: <subnet_name>
tags: openshiftClusterID=<infrastructure_ID>
securityGroups:
- filter: {}
name: <infrastructure_ID>-<node_role>
serverMetadata:
Name: <infrastructure_ID>-<node_role>
openshiftClusterID: <infrastructure_ID>
tags:
- openshiftClusterID=<infrastructure_ID>
trunk: true
userDataSecret:
name: <node_role>-user-data
availabilityZone: <optional_openstack_availability_zone>
----
<1> Add the UUID of your server group here.
. Optional: Back up the `manifests/99_openshift-cluster-api_worker-machineset-0.yaml` file. The installation program deletes the `manifests/` directory when creating the cluster.
When you install the cluster, the installer uses the `MachineSet` definition that you modified to create compute machines within your {rh-openstack} server group.