我有一个mongo db的Kubernetes设置,在GKE中具有持久卷,如下所示:
apiVersion: v1
kind: PersistentVolume
metadata:
name: kb-front-db-pv
labels:
volume: kb-front-volume
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 15Gi
storageClassName: standard
gcePersistentDisk:
pdName: kb-front-db
fsType: xfs
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: kb-front-db-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
selector:
matchLabels:
volume: kb-front-volume
---
apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
name: kb-front-db
labels:
app: kb-front-db
spec:
replicas: 1
selector:
matchLabels:
app: kb-front-db
template:
metadata:
labels:
app: kb-front-db
spec:
containers:
- name: kb-front-mongo
image: mongo:4.1.13-bionic
livenessProbe:
exec:
command:
- mongo
- --eval
- "db.adminCommand('ping')"
readinessProbe:
exec:
command:
- mongo
- --eval
- "db.adminCommand('ping')"
ports:
- containerPort: 27017
volumeMounts:
- name: database-mount
mountPath: "/data/db"
volumes:
- name: database-mount
persistentVolumeClaim:
claimName: kb-front-db-pvc
---
apiVersion: v1
kind: Service
metadata:
name: kb-front-db
spec:
ports:
- port: 27017
protocol: TCP
selector:
app: kb-front-db
我在GCE上的europe-north1-a中创建了一个名为kb-front-db的磁盘,我明白了:
~/d/p/kb-ops ❯❯❯ kubectl describe pv kb-front-db-pv ⏎ master ✖ ✱ ◼
Name: kb-front-db-pv
Labels: failure-domain.beta.kubernetes.io/region=europe-north1
failure-domain.beta.kubernetes.io/zone=europe-north1-a
volume=kb-front-volume
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"PersistentVolume","metadata":{"annotations":{},"labels":{"volume":"kb-front-volume"},"name":"kb-front-db-pv"},"...
pv.kubernetes.io/bound-by-controller: yes
Finalizers: [kubernetes.io/pv-protection]
StorageClass: standard
Status: Bound
Claim: default/kb-front-db-pvc
Reclaim Policy: Retain
Access Modes: RWO
Capacity: 15Gi
Node Affinity:
Required Terms:
Term 0: failure-domain.beta.kubernetes.io/region in [europe-north1]
failure-domain.beta.kubernetes.io/zone in [europe-north1-a]
Message:
Source:
Type: GCEPersistentDisk (a Persistent Disk resource in Google Compute Engine)
PDName: kb-front-db
FSType: xfs
Partition: 0
ReadOnly: false
Events: <none>
搜索这些我遇到的错误标签
但是我根本不理解这段文字。
该磁盘在Google控制台中看起来不错。批量索赔已绑定:
~/d/p/kb-ops ❯❯❯ kubectl describe pvc kb-front-db-pvc master ✖ ✱ ◼
Name: kb-front-db-pvc
Namespace: default
StorageClass: standard
Status: Bound
Volume: kb-front-db-pv
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"name":"kb-front-db-pvc","namespace":"default"},"spec":{"ac...
pv.kubernetes.io/bind-completed: yes
pv.kubernetes.io/bound-by-controller: yes
volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/gce-pd
Finalizers: [kubernetes.io/pvc-protection]
Capacity: 15Gi
Access Modes: RWO
Events: <none>
Mounted By: kb-front-db-wzx2c
但是为mongo实例提供服务的Pod被卡在ContainerCreating中,并出现以下错误:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedMount 7m12s (x448 over 17h) kubelet, gke-woodenstake-cluster-1-pool-2-2edf41e5-fdrg Unable to mount volumes for pod "kb-front-db-wzx2c_default(ba352929-968a-11e9-afbe-42010aa600fd)": timeout expired waiting for volumes to attach or mount for pod "default"/"kb-front-db-wzx2c". list of unmounted volumes=[database-mount]. list of unattached volumes=[database-mount default-token-6pb9l]
Warning FailedMount 2m30s (x505 over 17h) kubelet, gke-woodenstake-cluster-1-pool-2-2edf41e5-fdrg MountVolume.MountDevice failed for volume "kb-front-db-pv" : executable file not found in $PATH
这是什么意思?
答案 0 :(得分:2)
答案 1 :(得分:1)
发现该错误:
executable file not found in $PATH
来自尝试挂载xfs。因此,在PersistantVolume上将其更改为ext4并重新创建使其可以工作。不过还是想使用xfs,所以我会尽快重新访问…