Cluster reference

A Cluster definition includes a kubernetesVersion and a list of machinePools to deploy the cluster to.

For how to select a kubernetesVersion please check our Kubernetes Versions page.

A machinePool is a bundle of configuration with a ObjectReference so the cluster is deployed to those machinePools with the proper roles (etcd, control-plane, worker) with a quantity (how many nodes to deploy from this pool) and some extra configurations (rolling update config, max unhealthy nodes, etc…).

Example

  1. kind: Cluster
  2. apiVersion: provisioning.cattle.io/v1
  3. metadata:
  4. name: ...
  5. namespace: ...
  6. spec:
  7. rkeConfig:
  8. machinePools:
  9. - name: ...
  10. controlPlaneRole: ...
  11. etcdRole: ...
  12. workerRole: ...
  13. quantity: ...
  14. machineConfigRef:
  15. apiVersion: elemental.cattle.io/v1beta1
  16. kind: MachineInventorySelectorTemplate
  17. name: ...
  18. - name: ...
  19. controlPlaneRole: ...
  20. etcdRole: ...
  21. workerRole: ...
  22. quantity: ...
  23. machineConfigRef:
  24. apiVersion: elemental.cattle.io/v1beta1
  25. kind: MachineInventorySelectorTemplate
  26. name: ...

It’s also possible to disable cluster components via the Cluster object in spec.rkeConfig.machineGlobalConfig, for example:

Service Disabling Example

  1. kind: Cluster
  2. apiVersion: provisioning.cattle.io/v1
  3. metadata:
  4. name: ...
  5. namespace: ...
  6. spec:
  7. rkeConfig:
  8. machinePools:
  9. - name: ...
  10. controlPlaneRole: ...
  11. etcdRole: ...
  12. workerRole: ...
  13. quantity: ...
  14. machineConfigRef:
  15. apiVersion: elemental.cattle.io/v1beta1
  16. kind: MachineInventorySelectorTemplate
  17. name: ...
  18. machineGlobalConfig:
  19. disable:
  20. - servicelb
  21. - ...

rkeConfig.machinePools

A list of machinePools. A minimum of 1 machinePools is required for the cluster to be deployed to.

machinePools Spec Reference

KeyTypeDefault valueDescription
controlPlaneRoleboolfalseSet machines in this pool as control-plane
etcdRoleboolfalseSet machines in this pool as etcd
workerRoleboolfalseSet machines in this pool as worker
namestringnilName for this pool
quantityintnilNumber of machines to deploy from this pool
unhealthyNodeTimeoutintnilTimeout for unhealthy node health checks
machineConfigRefintObjectReferenceReference to an object used to know what nodes are part of this pool

A minimum of quantity set to one is required for this pool to be used. Basically translates to how many nodes from this pool are going to be setup for this cluster.

Example

  1. kind: Cluster
  2. apiVersion: provisioning.cattle.io/v1
  3. metadata:
  4. name: cluster-example
  5. namespace: example-default
  6. spec:
  7. rkeConfig:
  8. machinePools:
  9. - name: examplePool
  10. controlPlaneRole: true
  11. etcdRole: true
  12. workerRole: false
  13. quantity: 3
  14. unhealthyNodeTimeout: 0s
  15. machineConfigRef:
  16. apiVersion: elemental.cattle.io/v1beta1
  17. kind: MachineInventorySelectorTemplate
  18. name: exampleSelector

machineConfigRef Spec Reference

A machineConfigRef is a generic k8s ObjectReference which usually contain a kind name and apiVersion to point to a different object.

In Elemental, we set this to a MachineInventorySelectorTemplate. This allows us to point to more than one object by using the selector.

Example

The example below creates a cluster that uses 2 different machinePool‘s to set different nodes to control-plane and workers nodes, based on 2 different MachineInventorySelectorTemplate that select their nodes based on a MachineInventory label (location):

Cluster reference - 图1warning

The labels for the example are manual set labels, they are not set by Elemental automatically..

For automatic labels generated by Elemental please check the SMBIOS page.

Example of a cluster with more than one machinePool

  1. kind: Cluster
  2. apiVersion: provisioning.cattle.io/v1
  3. metadata:
  4. name: cluster-machinepools
  5. namespace: fleet-default
  6. spec:
  7. rkeConfig:
  8. machinePools:
  9. - name: controlPlanePool
  10. controlPlaneRole: true
  11. etcdRole: true
  12. workerRole: false
  13. quantity: 3
  14. unhealthyNodeTimeout: 0s
  15. machineConfigRef:
  16. apiVersion: elemental.cattle.io/v1beta1
  17. kind: MachineInventorySelectorTemplate
  18. name: selectorControlPlanes
  19. - name: workersPool
  20. controlPlaneRole: false
  21. etcdRole: false
  22. workerRole: true
  23. quantity: 1
  24. unhealthyNodeTimeout: 0s
  25. machineConfigRef:
  26. apiVersion: elemental.cattle.io/v1beta1
  27. kind: MachineInventorySelectorTemplate
  28. name: selectorWorkers
  29. kubernetesVersion: v1.23.7+k3s1
  30. ---
  31. apiVersion: elemental.cattle.io/v1beta1
  32. kind: MachineInventorySelectorTemplate
  33. metadata:
  34. name: selectorControlPlanes
  35. namespace: fleet-default
  36. spec:
  37. template:
  38. spec:
  39. selector:
  40. matchLabels:
  41. location: server-room-1
  42. ---
  43. apiVersion: elemental.cattle.io/v1beta1
  44. kind: MachineInventorySelectorTemplate
  45. metadata:
  46. name: selectorWorkers
  47. namespace: fleet-default
  48. spec:
  49. template:
  50. spec:
  51. selector:
  52. matchLabels:
  53. location: server-room-2