CLI Node Affinity
How to target a specific group of nodes for deployment using tags with the Orka CLI.
Quick navigation
Jump to: 1a. Tagging nodes | 1b. Untagging nodes | 2a. Configuring the VM tag settings | 2b. Overriding the VM tag settings
See also: How does node affinity work | Caveats
Quick command summary
orka node tag -n <NODE> --tag <TAG> -y
orka node untag -n <NODE> --tag <TAG> -y
orka vm create-config -v <VM_NAME> -b <BASE_IMAGE> -c <CPU> -C <vCPU> --tag <TAG> --tag-required <YES or NO> -y
OR
orka vm create -v <VM_NAME> -b <BASE_IMAGE> -c <CPU> -C <vCPU> --tag <TAG> --tag-required <YES or NO> -y
orka vm deploy -v <VM_NAME> --tag <TAG> --tag-required <YES or NO> -y
If you need to target a specific node or group of nodes during deployment, you can use node affinity (also: node tagging). Based on the tag required
setting, Orka might or might not attempt to deploy on other nodes if the deployment to the tagged node(s) fails.
Node affinity consists of two parts (performed in the specified order any number of times within the current limitations of the feature):
- Assign the tag to a node or a group of nodes
- Create a VM config with the tag and specify if the tag is required OR apply the tag during deployment and specify if it's required
1a. Tagging nodes
You can add one tag to one node at a time. One node can have multiple tags.
Run:
orka node tag -n <NODE> --tag <TAG> -y
Replace <NODE>
with the name of the node that you want to tag.
Replace <TAG>
with the tag that you want to apply.
To check if the tag was properly applied, run:
orka nodes
Orka shows your tag in the Tags
column.
1b. Untagging nodes
You can remove one tag from one node at a time.
Run:
orka node untag -n <NODE> --tag <TAG> -y
Replace <NODE>
with the name of the node that you want to untag.
Replace <TAG>
with the tag that you want to remove.
To check if the tag was properly removed, run:
orka nodes
2a. Configuring the VM tag settings
You can configure your VM tag settings when you are creating the VM config. These settings will be applied on every deployment, unless explicitly overridden.
You can apply only one tag to a VM config.
Run:
orka vm create-config -v <VM-NAME> -b <BASE-IMAGE> -c <CPU> -C <vCPU> --tag <TAG> --tag-required <YES or NO> -y
OR (to create the VM config and immediately deploy a VM)
orka vm create -v <VM-NAME> -b <BASE-IMAGE> -c <CPU> -C <vCPU> --tag <TAG> --tag-required <YES or NO> -y
Replace <VM-NAME>
with the name you want to use for our VM config.
Replace <BASE-IMAGE>
with the Intel- or Apple silicon-based image that you want to use. For example: 90GBVenturaSSH.orkasi
.
Set valid values for <CPU>
and <vCPU>
.
Replace <TAG>
with the tag you want to apply.
Set --tag-required
to yes
or no
. When yes
, Orka will never attempt to deploy on nodes that do not match the tag
.
2b. Overriding the VM tag settings
You can override the VM config settings for tag
and tag_required
during deployment. The VM config might or might not have any existing tag settings.
You can apply only one tag during deployment.
Run:
orka vm deploy -v <VM-NAME> --tag <TAG> --tag-required <YES or NO> -y
Replace <VM-NAME>
with the name of the VM config you want to deploy.
Replace <TAG>
with the tag you want to apply.
Set --tag-required
to yes
or no
. When yes
, Orka will never attempt to deploy on nodes that do not match the tag
.
What's next
Create and deploy Orka virtual machines.
Updated almost 2 years ago