Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

DO Block storage only can mount into a single Node (VM). So, when I provision PV/PVC it creates a block storage.
I am implementing helm chart bitnami/mysql where I want to create the mysql pod only into the node the PVC is mounted.
How should I go about it? I have tried with Affinity but I have some issues with it as I can not label nodes. Here is my configuration values.yml file
global:
storageClass: do-block-storage
architecture: standalone
primary:
name: primary
persistence:
enabled: true
existingClaim: backend-mysql-primary
accessModes:
- ReadWriteOnce
size: 10Gi
selector: {}
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: topology.kubernetes.io/region
namespaces:
- sportsdemy
labelSelector:
matchExpressions:
- key: pvc
operator: In
values:
- backend-mysql-primary
This config throws the following error:
error validating "": error validating data: ValidationError(StatefulSet.spec.template.spec.affinity.podAffinity.requiredDuringSchedulingIgnoredDuringExecution[0]): missing required field "topologyKey" in io.k8s.api.core.v1.PodAffinityTerm
So it looks like a topologyKey is required but I am not sure how it is helpful here.
But I went ahead and tried to add the topologyKey from labels assigned to the node by DOKS. topology.kubernetes.io/region
Deployment is applying without issues but pod is assigned to any node:
0/2 nodes are available: 2 node(s) didn't match pod affinity rules. preemption: 0/2 nodes are available: 2 Preemption is not helpful for scheduling.
pod didn't trigger scale-up: 1 node(s) didn't match pod affinity rules
Here is the yml file for volumes:
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: backend-mysql-primary
namespace: sportsdemy
labels:
pvc: backend-mysql-primary
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: do-block-storage
Goal: I have labeled my pv as pvc: backend-mysql-primary and want to a node where I have the PV.
jazzybruno
jazzybruno
9c24208528c843f2bcdb7d54782c69
Sean DesPortes
Robin van der Knaap
Robin van der Knaap
Attila Kovacs
Tomy Hsieh
Tuschl
Alexander Freyr
marcelhaldimann
Emiliano Maccaferri