DEV Community

Maxime Guilbert
Maxime Guilbert

Posted on • Edited on

5 1 1 1

What does the error "Volume node affinity conflict" mean ?

When you deploy a pod, are doing a cluster update or you are just cleaning a node, you can have pods stuck in a ""Pending" state.

If you describe the pod, you may see an event with the follow error :



2 node(s) had volume node affinity conflict.


Enter fullscreen mode Exit fullscreen mode

This error means that the node where your pod is deployed doesn't match with the affinity of a volume attached to the pod.

For example, you have deployed your services in AWS and setup high availability for your volumes & services. Using AZ us-east-1a & us-east-1b in our case.
If you block the deployment on all nodes in us-east-1a and you have volumes which requires to be in us-east-1b, you will have this issue.


How to find the volume affinity

To find the volume affinity, you need to find the PersistentVolume linked to your pod and check its definition.

You can start from the Pod to find the associated PersistentVolumeClaim



$ kubectl describe pod my-pod
Name:           my-pod
Namespace:      default
(...)
Volumes:
  volume:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  volume-my-prod
    ReadOnly:   false
(...)


Enter fullscreen mode Exit fullscreen mode

Then from the PersistentVolumeClaim, find the PersistentVolume



$ kubectl get pvc
NAME                                          STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
volume-my-prod                 Bound    pvc-toto   200Gi      RWO            ebs-gp2        41d


Enter fullscreen mode Exit fullscreen mode

And then, describe the PersistentVolume



$ kubectl get pv pvc-toto -o yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pvc-toto
spec:
  (...)
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: topology.ebs.csi.aws.com/zone
          operator: In
          values:
          - us-east-1a
  (...)


Enter fullscreen mode Exit fullscreen mode

In this case, we can see that the volume needs to be in the us-east-1a AZ, so the related pod too.

Now that you have this information, you should be able to understand what is going wrong with the current node and resolve the issue.


I hope it will help you! 🍺


You want to support me?

Buy Me A Coffee

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay