Skip to content

Commit d7cd553

Browse files
author
Daman Arora
committed
add affinity group support for CKS cluster nodes
1 parent 7f677cc commit d7cd553

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

source/plugins/cloudstack-kubernetes-service.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,44 @@ Administrators are able to dedicate hosts to a domain or account. CloudStack wil
653653
.. note::
654654
By design the hosts dedication does not consider the deployment of system VMs on the dedicated hosts (SSVM, CPVM and Virtual Routers). In case the Kubernetes cluster is created on an unimplemented network then the Virtual Router of the network will not be deployed on the dedicated hosts.
655655

656+
Affinity groups for CKS cluster nodes
657+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
658+
659+
From 4.23.0 onwards, users can specify host affinity or anti-affinity groups for different types of Kubernetes cluster nodes (control, worker, etcd) during cluster creation. This provides control over VM placement on hosts for high availability requirements.
660+
661+
To use affinity groups with CKS clusters:
662+
663+
1. Create the desired affinity groups (host affinity or host anti-affinity) beforehand using the CloudStack UI or API.
664+
665+
2. When creating a Kubernetes cluster, specify the affinity group mapping using the **nodeaffinitygroups** parameter. This parameter accepts a mapping of node types to affinity group UUIDs with two fields per entry:
666+
667+
- ``node``: The node type (permitted values: ``worker``, ``control``, ``etcd``)
668+
- ``affinitygroup``: The UUID of the desired affinity group
669+
670+
Example using the API:
671+
672+
.. code-block:: bash
673+
674+
cmk create kubernetescluster name=MyCluster zoneid=<zone-uuid> kubernetesversionid=<version-uuid> serviceofferingid=<offering-uuid> size=3 nodeaffinitygroups[0].node=worker nodeaffinitygroups[0].affinitygroup=<affinity-group-uuid>
675+
676+
Multiple affinity groups can be assigned to a single node type by providing comma-separated UUIDs:
677+
678+
.. code-block:: bash
679+
680+
nodeaffinitygroups[0].affinitygroup=<uuid1>,<uuid2>
681+
682+
Different node types can have different affinity group configurations:
683+
684+
.. code-block:: bash
685+
686+
nodeaffinitygroups[0].node=control nodeaffinitygroups[0].affinitygroup=<control-ag-uuid> nodeaffinitygroups[1].node=worker nodeaffinitygroups[1].affinitygroup=<worker-ag-uuid>
687+
688+
The affinity group configuration is persisted and automatically applied when scaling the cluster - new worker nodes inherit the affinity group settings without requiring additional parameters.
689+
690+
.. note::
691+
- When used together with host dedication, affinity group rules are applied within the set of dedicated hosts.
692+
- When adding external worker nodes to an existing cluster using ``addNodesToKubernetesCluster``, the nodes are validated against any worker affinity groups configured for the cluster.
693+
656694
Use diverse CNI plugins (Calico, Cilium, etc)
657695
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
658696

0 commit comments

Comments
 (0)