我在Ubuntu桌面上的Kubernetes上部署了Minio。它工作得很好,除了每当我重新启动机器时,存储在Minio中的所有东西都神秘地消失了(如果我创建了几个存储桶中的文件,那么在重新启动后我就会回到一个完全空白的石板上-这些存储桶和它们的所有文件都完全消失了)。
当我设置Minio时,我在Kubernetes中创建了一个持久卷,该卷挂载到一个文件夹(/mnt/minio/minio -我在/mnt/minio上挂载了一个4 TB的硬盘,里面有一个名为minio的文件夹)。
下面是我应用来部署我的minio安装的yaml文件:
kind: PersistentVolume
apiVersion: v1
metadata:
name: minio-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 100Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/minio/minio"apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio-pv-claim
labels:
app: minio-storage-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 99GiapiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
kind: Deployment
metadata:
# This name uniquely identifies the Deployment
name: minio-deployment
spec:
selector:
matchLabels:
app: minio
strategy:
type: Recreate
template:
metadata:
labels:
# Label is used as selector in the service.
app: minio
spec:
# Refer to the PVC created earlier
volumes:
- name: storage
persistentVolumeClaim:
# Name of the PVC created earlier
claimName: minio-pv-claim
containers:
- name: minio
# Pulls the default Minio image from Docker Hub
image: minio/minio:latest
args:
- server
- /storage
env:
# Minio access key and secret key
- name: MINIO_ACCESS_KEY
value: "minio"
- name: MINIO_SECRET_KEY
value: "minio123"
ports:
- containerPort: 9000
hostPort: 9000
# Mount the volume into the pod
volumeMounts:
- name: storage # must match the volume name, above
mountPath: "/mnt/minio/minio"apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
type: LoadBalancer
ports:
- port: 9000
targetPort: 9000
protocol: TCP
selector:
app: minio发布于 2020-03-08 03:40:12
您需要在容器/mnt/minio/minio/;的挂载目录下挂载容器的/storage目录
args:
- server
- /mnt/minio/minio/storage但请考虑使用StatefulSet进行部署,这样当pod重新启动时,它将保留以前pod的所有内容。
https://stackoverflow.com/questions/57421167
复制相似问题