如何将 SQLite 数据库放置在 NFS 持久卷之外
How to place SQLite database outside of NFS Persistent Volume
我在裸机上有一个多节点 (2) Kubernetes 集群 运行ning。我知道 1. hostPath 不利于生产,2. 多节点设置不支持 hostPath 持久卷。有没有一种方法可以安全地 运行 由 SQLite 数据库支持的应用程序?在 NFS 上,数据库锁定很多,确实会损害应用程序的性能。
我可能会将每个应用程序的 SQLite 数据库放在 hostPath 卷上,然后一切都会再次 运行 顺利进行。但我想知道是否有一些解决方法可以实现这一点,即使我必须将应用程序限制到特定节点。
您似乎应该使用 Local Persistent Volumes GA.
根据文档:
A local volume represents a mounted local storage device such as a disk, partition or directory.
Compared to hostPath volumes, local volumes can be used in a durable and portable manner without manually scheduling Pods to nodes, as the system is aware of the volume’s node constraints by looking at the node affinity on the PersistentVolume.
但是:
At GA, Local Persistent Volumes do not support dynamic volume provisioning.
举个例子:
apiVersion: v1
kind: PersistentVolume
metadata:
name: example-pv
spec:
capacity:
storage: 100Gi
# volumeMode field requires BlockVolume Alpha feature gate to be enabled.
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
storageClassName: local-storage
local:
path: /mnt/disks/ssd1
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- example-node
With Local Persistent Volumes, the Kubernetes scheduler ensures that a pod using a Local Persistent Volume is always scheduled to the same node
我在裸机上有一个多节点 (2) Kubernetes 集群 运行ning。我知道 1. hostPath 不利于生产,2. 多节点设置不支持 hostPath 持久卷。有没有一种方法可以安全地 运行 由 SQLite 数据库支持的应用程序?在 NFS 上,数据库锁定很多,确实会损害应用程序的性能。
我可能会将每个应用程序的 SQLite 数据库放在 hostPath 卷上,然后一切都会再次 运行 顺利进行。但我想知道是否有一些解决方法可以实现这一点,即使我必须将应用程序限制到特定节点。
您似乎应该使用 Local Persistent Volumes GA.
根据文档:
A local volume represents a mounted local storage device such as a disk, partition or directory.
Compared to hostPath volumes, local volumes can be used in a durable and portable manner without manually scheduling Pods to nodes, as the system is aware of the volume’s node constraints by looking at the node affinity on the PersistentVolume.
但是:
At GA, Local Persistent Volumes do not support dynamic volume provisioning.
举个例子:
apiVersion: v1
kind: PersistentVolume
metadata:
name: example-pv
spec:
capacity:
storage: 100Gi
# volumeMode field requires BlockVolume Alpha feature gate to be enabled.
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
storageClassName: local-storage
local:
path: /mnt/disks/ssd1
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- example-node
With Local Persistent Volumes, the Kubernetes scheduler ensures that a pod using a Local Persistent Volume is always scheduled to the same node