fbpx
Get Started Free
Unlock the power of choice with CloudPlex and DigitalOcean Get CloudPlex free for 3 months, and Digital Ocean for 1 month

Associating Pods to Nodes

Pain Point

Kubernetes scheduler automatically provides a reasonable placement of nodes on pods (e.g. it does not place the pod on a node with insufficient free resources, etc.), but there are some circumstances where you may need more control on a node where a pod lands. For example, a developer may decide to deploy compute-intensive containers on the compute-optimized nodes.

If you want to deploy specific pods to specific nodes, it is not an easy process in Kubernetes. The developers need to label nodes and then apply the appropriate selectors to the deployments. Often times, developers have to configure complex affinity rules to allocate a set of deployments to a group of nodes. This becomes increasingly complex if you have a diverse pool of nodes.

The following YAML snippet shows the configuration required to land a Pod on a node with SSD storage.

pod.yaml

https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/pods/pod-nginx.yaml

apiVersion: v1
kind: Pod
metadata:
  name: nginx
  labels:
    env: test
spec:
  containers:
  - name: nginx
    image: nginx
    imagePullPolicy: IfNotPresent
  nodeSelector:
    disktype: ssd

The developer has to add labels to their Node objects and use those labels in the node selectors. For example, example.com.node-restriction.kubernetes.io/fips=true or disktype=ssd

Developers have to label all the nodes which have SSD disk type. This is a tedious task. The following kubectl command applies specific labels to the nodes kubectl label nodes disktype=ssd

How CloudPlex addresses your pain

In CloudPlex, you can visualize your nodes and deployments in a single view and simply attach deployments to nodes through a visual interface. Node labeling and selectors are automatically handled by the platform.

node-pod