===============================================================
Create label to run the buildon pod in a particular slave node using node affinity.
kubectl get nodes
To Show label: kubectl get nodes --show-labels | grep slavelabel
kubectl label nodes <slavenodename> thisnode=slavelabel
kubectl get nodes --show-labels | grep slavelabel
To delete label: kubectl label nodes <slavenodename> thisnode-
======================================================================
Below JSON format works fine in --overrides to run the pod in the particular slave node.
=======================================================================
kubectl run -i --tty buildon-<<commitid>>--rm --image=devopsbasservice/buildonframework:buildon-v1.0 --restart=Never --overrides='
{
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"name": "buildonslavenodeaffinity"
},
"spec": {
"affinity": {
"nodeAffinity": {
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{
"matchExpressions": [
{
"key": "thisnode",
"operator": "In",
"values": [
"slavelabel"
]
}
]
}
]
}
}
}
}
}
'