So i try to set the manually assign Pvcs in the node wise Pods in kubernets So i have one Statefulset with 2 replicas and 2 PVCs The code is like this
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: busybox-pvc-0
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: standard # Change this if needed
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: busybox-pvc-1
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: standard # Change this if needed
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: busybox
spec:
serviceName: "busybox"
replicas: 2
selector:
matchLabels:
app: busybox
template:
metadata:
labels:
app: busybox
spec:
containers:
- name: busybox
image: busybox
command: ["/bin/sh", "-c", "sleep 3600"]
volumeMounts:
- name: busybox-storage-0
mountPath: /data0
- name: busybox-storage-1
mountPath: /data1
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- minikube
- minikube-m02
volumes:
- name: busybox-storage-0
persistentVolumeClaim:
claimName: busybox-pvc-0
- name: busybox-storage-1
persistentVolumeClaim:
claimName: busybox-pvc-1
So i try to do this code and see the reaction of this code the Output is
busybox-0 → minikube → busybox-pvc-0 , busybox-pvc-1 ,
busybox-1 → minikube-m02 → busybox-pvc-0 , busybox-pvc-1
but i want to this Output :
busybox-0 → minikube → busybox-pvc-0 ,
busybox-1 → minikube-m02 → busybox-pvc-1
in this outputs
Pods is busybox-0 , busybox-1 and Nodes is minikube , minikube-m02 and PVCs is busybox-pvc-0 , busybox-pvc-1
Cluster information:
Kubernetes version:
Client Version: v1.31.0
Kustomize Version: v5.4.2
Server Version: v1.31.0