Closed HanHoRang31 closed 5 months ago
+1
You can do it in your service via tolerations and nodeSelection. pod local-path-provisioner deploying via deployment so it can be run as single replica
Do you have an example to give us ?
sure my storageClass has name openebs-lvm-vghdd tolerations
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: vghdd-pvc
spec:
storageClassName: openebs-lvm-vghdd
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mtkpi-pod
labels:
app: mtkpi
spec:
replicas: 1
selector:
matchLabels:
app: mtkpi
template:
metadata:
labels:
app: mtkpi
spec:
containers:
- resources:
name: mtkpi-pod
image: r0binak/mtkpi:v1
ports:
- containerPort: 7681
securityContext:
readOnlyRootFilesystem: true
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /data_hdd
name: pvc-data-hdd
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/lvmhdd
operator: Exists
volumes:
- name: pvc-data-hdd
persistentVolumeClaim:
claimName: vghdd-pvc
nodeselector
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: vghdd-pvc
spec:
storageClassName: openebs-lvm-vghdd
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mtkpi-pod
labels:
app: mtkpi
spec:
replicas: 1
selector:
matchLabels:
app: mtkpi
template:
metadata:
labels:
app: mtkpi
spec:
containers:
- resources:
name: mtkpi-pod
image: r0binak/mtkpi:v1
ports:
- containerPort: 7681
securityContext:
readOnlyRootFilesystem: true
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /data_hdd
name: pvc-data-hdd
nodeSelector:
disktype: hdd
volumes:
- name: pvc-data-hdd
persistentVolumeClaim:
claimName: vghdd-pvc
Thx!
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
It's a feature question. I want to set up a local volume only on specific nodes(ex. node1, node2, node3) Can I simply deploy the local-path-provisioner pods on the nodes that will use the local volume using toleration and nodeselector?