rancher / local-path-provisioner

Dynamically provisioning persistent local storage with Kubernetes
Apache License 2.0
2.26k stars 454 forks source link

Can I deploy the local-path-provisioner pod to multiple nodes? #305

Closed HanHoRang31 closed 5 months ago

HanHoRang31 commented 1 year ago

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?

Sensei-CHO commented 1 year ago

+1

artarik commented 1 year ago

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

Sensei-CHO commented 1 year ago

Do you have an example to give us ?

artarik commented 1 year ago

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
Sensei-CHO commented 1 year ago

Thx!

github-actions[bot] commented 5 months ago

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.

github-actions[bot] commented 5 months ago

This issue was closed because it has been stalled for 5 days with no activity.