我是Kubernetes的新手,我跟随GKE Elasticsearch 5 Getting Started doc。当使用PersistentVolumeClaim 和 configMap(挂载本地,我的笔记本电脑,容器路径)时,我无法启动集群。它在删除configMap时有效。
kubectl version
:
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2017-06-29T23:15:59Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"clean", BuildDate:"2017-05-19T18:33:17Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
kubectl describe pod some-elasticsearch
输出错误:
[SchedulerPredicates failed due to persistentvolumeclaim "elasticsearchdata" not found, which is unexpected., SchedulerPredicates failed due to persistentvolumeclaim "elasticsearchdata" not found
。
[SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "elasticsearchdata", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound
卷显示为绑定。有什么建议?这是我的pod.yaml
:
metadata:
name: some-elasticsearch
labels:
name: some-elasticsearch
spec:
containers:
- image: launcher.gcr.io/google/elasticsearch5
name: elasticsearch
volumeMounts:
- name: elasticsearchdata
mountPath: /usr/share/elasticsearch/data
- name: elasticsearchconfig
mountPath: /usr/share/elasticsearch/config
volumes:
- name: elasticsearchdata
persistentVolumeClaim:
claimName: elasticsearchdata
- name: elasticsearchconfig
configMap:
name: elasticsearchconfig
---
# Request a persistent volume from the cluster using a Persistent Volume Claim.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: elasticsearchdata
annotations:
volume.alpha.kubernetes.io/storage-class: default
spec:
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 5Gi
如果我注释掉elasticsearchconfig
,则群集会成功启动:
- name: elasticsearchconfig
mountPath: /usr/share/elasticsearch/config
- name: elasticsearchconfig
configMap:
name: elasticsearchconfig
kubectl describe pvc elasticsearchdata
的输出:
Name: elasticsearchdata
Namespace: default
StorageClass: standard
Status: Bound
Volume: pvc-52f0d3d2-6d57-11e7-94f6-42010af002a5
Labels: <none>
Annotations: pv.kubernetes.io/bind-completed=yes
pv.kubernetes.io/bound-by-controller=yes
volume.alpha.kubernetes.io/storage-class=default
volume.beta.kubernetes.io/storage-provisioner=kubernetes.io/gce-pd
Capacity: 5Gi
Access Modes: RWO
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
2m 2m 1 persistentvolume-controller Normal ProvisioningIgnoreAlpha both "volume.alpha.kubernetes.io/storage-class" annotation and storageClassName are present, using storageClassName
2m 2m 1 persistentvolume-controller Normal ProvisioningSucceeded Successfully provisioned volume pvc-52f0d3d2-6d57-11e7-94f6-42010af002a5 using kubernetes.io/gce-pd
我希望拥有持久存储空间,并且需要从elasticsearch.yml
configMap加载自定义elasticsearchconfig
。