Scheduling pods to particular nodes

How do I constrain scheduling WebLogic Server pods to a particular set of nodes?

To do this:

First, set a label on the nodes on which the WebLogic Server pods will run. For example:

$ kubectl label nodes name=weblogic-pods

In the Domain CR, set a nodeSelector: a selector which must match a node’s labels for the pod to be scheduled on that node. See kubectl explain pods.spec.nodeSelector.

You can set nodeSelector labels for WebLogic Server pods, all server pods in a cluster, or all server pods in a domain. nodeSelector is a field under the serverPod element, which occurs at several points in the Domain CR schema:

  • At the top-level spec.severPod for the entire domain
  • At spec.adminServer.serverPod for the Administration Server
  • At spec.clusters[*].serverPod for each cluster
  • At spec.managedServers[*].serverPod for individual Managed Servers

Under that level, you specify labels and values that match the labels on the nodes you want to select. For example:

  name: weblogic-pods

For more details, see Assign Pods to Nodes in the Kubernetes documentation.