Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

===============================================================

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"

                           ]

                        }

                     ]

                  }

               ]

            }

         }

      }

   }

}

'

  • No labels