Я пытаюсь запустить приложение с постоянным хранилищем в GKE.
Я пытался использовать динамическое постоянное хранилище, но у меня недостаточно прав на диск.
Когда я создаю класс хранения, PersistentVolume & PersistentVolumeClaim
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: documentation-7-x-storageclass
labels:
product: "documentation-7-x"
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-standard
zone: europe-west1-b
apiVersion: v1
kind: PersistentVolume
metadata:
name: documentation-7-x-volume
labels:
product: "documentation-7-x"
spec:
capacity:
storage: 500Gi
accessModes:
- ReadWriteOnce
storageClassName: documentation-7-x-storageclass
persistentVolumeReclaimPolicy: Retain
gcePersistentDisk:
fsType: "ext4"
pdName: "documentationstorage"
mountOptions:
- dir_mode=0777
- file_mode=0777
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: documentation-7-x-volume-claim
labels:
product: "documentation-7-x"
spec:
volumeName: documentation-7-x-volume
storageClassName: documentation-7-x-storageclass
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
Это правильно создать в GKE.
kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
documentation-7-x-volume 500Gi RWO Retain Bound default/documentation-7-x-volume-claim documentation-7-x-storageclass 3m
Но когда я использую заявку на создание в моем приложении, я получаю сообщение об ошибке.
# Create a deployment for the Documentation
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: documentation-7-x
labels:
product: "documentation-7-x"
spec:
replicas: 1
selector:
matchLabels:
app: documentation-7-x
product: "documentation-7-x"
template:
metadata:
labels:
app: documentation-7-x
product: "documentation-7-x"
spec:
volumes:
- name: documentation-7-x-volume
persistentVolumeClaim:
claimName: documentation-7-x-volume-claim
containers:
- name: documentation-7-x
image: atlassian/confluence-server:6.3.2
imagePullPolicy: Always
ports:
- containerPort: 8090
# Mount the volume claimed above
volumeMounts:
- name: documentation-7-x-volume
mountPath: /var/atlassian/application-data/confluence
---
# Create service for the Documentation
apiVersion: v1
kind: Service
metadata:
name: documentation-7-x-service
labels:
product: "documentation-7-x"
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8090
selector:
app: documentation-7-x
product: "documentation-7-x"
Ошибка:
MountVolume.MountDevice failed for volume "documentation-7-x-volume" : mount failed: exit status 32 Mounting command: systemd-run Mounting arguments: --description=Kubernetes transient mount for /var/lib/kubelet/plugins/kubernetes.io/gce-pd/mounts/fontoxmldocumentstorage --scope -- mount -t ext4 -o dir_mode=0777,file_mode=0777,defaults /dev/disk/by-id/google-fontoxmldocumentstorage /var/lib/kubelet/plugins/kubernetes.io/gce-pd/mounts/fontoxmldocumentstorage Output: Running scope as unit: run-r49218112baa6471a8b4a3e2b4ad68aaa.scope mount: wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so.
Я попробовал ту же концепцию на AKS с помощью azure-файлов, и это работает без проблем.
Какой шаг я пропускаю в GKE?
UPDATE
Я нашел, где выполнить команду dmesg | tail
и получил:
[ 9793.897427] EXT4-fs (sdb): Unrecognized mount option "dir_mode=0777" or missing value
[ 9797.046199] EXT4-fs (sdb): Unrecognized mount option "dir_mode=0777" or missing value
[ 9802.139814] EXT4-fs (sdb): Unrecognized mount option "dir_mode=0777" or missing value
[ 9811.333114] EXT4-fs (sdb): Unrecognized mount option "file_mode=0777" or missing value
[ 9828.747800] EXT4-fs (sdb): Unrecognized mount option "dir_mode=0777" or missing value
[ 9862.074279] EXT4-fs (sdb): Unrecognized mount option "dir_mode=0777" or missing value
[ 9927.399967] EXT4-fs (sdb): Unrecognized mount option "dir_mode=0777" or missing value
[10050.664769] EXT4-fs (sdb): Unrecognized mount option "dir_mode=0777" or missing value
[10173.955638] EXT4-fs (sdb): Unrecognized mount option "file_mode=0777" or missing value
[10297.281253] EXT4-fs (sdb): Unrecognized mount option "dir_mode=0777" or missing value
Кажется, не все провайдеры поддерживают одинаковые параметры монтирования.