Skip to content

Commit 90b3554

Browse files
Damans227Daman Arora
andauthored
cks: add affinity group support for CKS cluster nodes (#620)
* add affinity group support for CKS cluster nodes * simplify notes * Add screenshot for affinity groups in CKS cluster creation --------- Co-authored-by: Daman Arora <daman.arora@shapeblue.com>
1 parent 49e152e commit 90b3554

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
26.4 KB
Loading

source/plugins/cloudstack-kubernetes-service.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,45 @@ 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+
|cks-create-cluster-affinity-groups.png|
662+
663+
To use affinity groups with CKS clusters:
664+
665+
1. Create the desired affinity groups (host affinity or host anti-affinity) beforehand using the CloudStack UI or API.
666+
667+
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:
668+
669+
- ``node``: The node type (permitted values: ``worker``, ``control``, ``etcd``)
670+
- ``affinitygroup``: The UUID of the desired affinity group
671+
672+
Example using the API:
673+
674+
.. code-block:: bash
675+
676+
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>
677+
678+
Multiple affinity groups can be assigned to a single node type by providing comma-separated UUIDs:
679+
680+
.. code-block:: bash
681+
682+
nodeaffinitygroups[0].affinitygroup=<uuid1>,<uuid2>
683+
684+
Different node types can have different affinity group configurations:
685+
686+
.. code-block:: bash
687+
688+
nodeaffinitygroups[0].node=control nodeaffinitygroups[0].affinitygroup=<control-ag-uuid> nodeaffinitygroups[1].node=worker nodeaffinitygroups[1].affinitygroup=<worker-ag-uuid>
689+
690+
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.
691+
692+
.. note::
693+
- When adding external worker nodes to an existing cluster using ``addNodesToKubernetesCluster``, the nodes are validated against any worker affinity groups configured for the cluster.
694+
656695
Use diverse CNI plugins (Calico, Cilium, etc)
657696
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
658697

@@ -809,6 +848,8 @@ kubectl delete pod --all -A
809848
:alt: Create Kubernetes Cluster form.
810849
.. |cks-create-cluster-additional-settings.png| image:: /_static/images/cks-create-cluster-additional-settings.png
811850
:alt: Create Kubernetes Cluster form with Advanced Settings.
851+
.. |cks-create-cluster-affinity-groups.png| image:: /_static/images/cks-create-cluster-affinity-groups.png
852+
:alt: Affinity groups selection in Create Kubernetes Cluster Advanced Settings.
812853
.. |cks-delete-action.png| image:: /_static/images/cks-delete-action.png
813854
:alt: Delete action icon.
814855
.. |cks-kube-config-action.png| image:: /_static/images/cks-kube-config-action.png

0 commit comments

Comments
 (0)