-
-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Local Storage Provider #67
Comments
Hey, thanks for creating this issue and providing your solution 👍 |
I am using https://github.com/rancher/local-path-provisioner for this at IQSS/dataverse-kubernetes k3s/k3d demo Obviously, you need to patch your PVCs. I did that via Kustomization ( |
I also just tested the Local Persistent Volumes which are GA since Kubernetes v1.14.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: test-deploy
labels:
app: test-deploy
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: test-deploy
template:
metadata:
name: test-deploy
labels:
app: test-deploy
spec:
containers:
- name: main
image: postgres
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /test
name: test-mount
volumes:
- name: test-mount
persistentVolumeClaim:
claimName: test-mount
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test-mount
spec:
volumeName: example-pv
storageClassName: local-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: example-pv
spec:
capacity:
storage: 1Gi
# volumeMode field requires BlockVolume Alpha feature gate to be enabled.
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: local-storage
local:
path: /tmp/test-pv
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- k3d-test-worker-0
This was just a test, to see that the thing is working 👍 |
Cool @iwilltry42! 👍 Let me emphasize a bit on an IMHO important aspect: local storage provider in K8s 1.14 is promising, but (as you noted) does not yet support dynamic provisioning. This is my only reason to favor rancher/local-path-provisioner over K8s local storage. |
k3s built-in local storage provider coming: https://twitter.com/ibuildthecloud/status/1167511203108638720 |
k8s local dynamic provisioning issue: |
k3s has the |
@iwilltry42 |
That seems to work well with |
Hi @deiwin, |
If it'd delete all deployments/statefulsets/daemonsets using PVCs and then all PVCs, then I think
You write above, that "However, one should note that the hostPath I'm working on a cluster setup that supports two different use cases: 1) start and stop the same long-running cluster with persistent storage (for a DB) and 2) recreate whole clusters from scratch fairly often. As I said, I haven't verified this, but I think case (1) requires persistence, but case (2) currently leaves behind data from PVCs that don't exist anymore in new clusters. As a workaround, I'm currently pairing |
Hey 👋 Is there any more need or input for this feature? |
What I am missing at least in the documentation is where the data is stored locally. |
I also think clean up is not needed from k3d when it comes to a mapped local file. a PV could be mapped to multiple clusters and otherwise the cleanup logic has to check for all that. |
Hi @vincentgerris , thanks for your input!
Docker does not have any option of adding mounts to existing containers, so there's no possibility for us to achieve this in k3d. You'd have to do the volume mounts upfront when creating the cluster. Update 1: I created an issue to put up some documentation on K3s features and how to use/modify them in k3d: #795 |
It would be great to have a default storage provider similar to what Minikube provides. This allows to deploy and develop Kubernetes pods requiring storage.
Scope of your request
Additional addon to deploy to single node clusters.
Describe the solution you'd like
I got it working by using the storage provisioner of Minikube by creating following resources:
Describe alternatives you've considered
An alternative might be local persistent volumes but the Minikube solution looks simpler. With the local persistent volumes it could work even with multiple nodes.
I'm not sure if the addon should be integrated into k3s directly. On the other hand I think it's more a feature required for local development and therefore probably fits better to k3d.
The text was updated successfully, but these errors were encountered: