pod具有未绑定的立即PersistentVolumeClaims ECK(Elasticsearch on Kubernetes)

时间:2020-07-14 11:48:06

标签: elasticsearch kubernetes

我正在尝试在本地minikube集群的kubernetes https://www.elastic.co/guide/en/cloud-on-k8s/current/index.html上部署弹性模块。我已经安装了操作员。

当我在下面应用Elasticsearch群集时,出现以下pod错误:

为广告连播“ data-es-es-default-0”运行“ VolumeBinding”过滤器插件: 吊舱具有未绑定的即时PersistentVolumeClaims

数量/声明:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: elasticsearch-data
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"

-

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: elasticsearch-data
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi

elastic.yml

apiVersion: elasticsearch.k8s.elastic.co/v1beta1
kind: Elasticsearch
metadata:
  name: data-es
spec:
  version: 7.4.2
  nodeSets:
  - name: default
    count: 2
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        storageClassName: standard
        resources:
          requests:
            storage: 10Gi
    config:
      node.master: true
      node.data: true
      node.ingest: true
      node.store.allow_mmap: false
      xpack.security.authc.realms:
        native:
          native1: 
            order: 1
---
apiVersion: kibana.k8s.elastic.co/v1beta1
kind: Kibana
metadata:
  name: data-kibana
spec:
  version: 7.4.2
  count: 1
  elasticsearchRef:
    name: data-es

kubectl获取pvc

NAME                                      STATUS    VOLUME             CAPACITY   ACCESS MODES   STORAGECLASS   AGE elasticsearch-data        Bound     elasticsearch-data   10Gi       RWO            standard      8m45s elasticsearch-data-data-es-es-default-0   Pending                standard       7m40s elasticsearch-data-data-es-es-default-1   Pending standard       7m39s

1 个答案:

答案 0 :(得分:3)

pod具有未绑定的立即PersistentVolumeClaims

以上错误表示没有persistentVolume可以绑定到PersistentVolumeClaim。默认情况下,local-storage不会真正动态创建persistentVolume

要使用local-storage存储类的动态预配置机制,您需要配置local-storage类,以便它可以预配置persistentVolume。查看此讨论Kubernetes: What is the best practice for create dynamic local volume to auto assign PVs for PVCs?

或者,不使用存储类的动态预配置机制,则需要使用persistentVolume创建一个hostPath,该PersistentVolumeClaim可以绑定到PersistentVolumeClaim。但这不是为生产使用推荐的解决方案。查看本指南here

volumeClaimTemplates将基于弹性Yaml中的PersistentVolumeClaim自动创建。因此,您不应该创建一个 nodeSets

由于PersistentVolumeClaim为2,因此创建了两个persistentVolume。因此,您需要创建两个apiVersion: v1 kind: PersistentVolume metadata: name: elasticsearch-data1 labels: type: local spec: storageClassName: standard capacity: storage: 10Gi accessModes: - ReadWriteOnce hostPath: path: "/mnt/data" --- apiVersion: v1 kind: PersistentVolume metadata: name: elasticsearch-data2 labels: type: local spec: storageClassName: standard capacity: storage: 10Gi accessModes: - ReadWriteOnce hostPath: path: "/mnt/data"

    function test(ids) {
        document.getElementById("myNav").style.width = "0%";
        var x = ids;
        //alert(ids + "---" + x)


        $.ajax({
            type: 'POST',
            url: '@Url.Action("ProductList1")',
            dataType: 'html',
            UpdateTargetId: 'loads',
            data: {
                Id: x,
            },
            success: function (status) {
                console.log('Send');
                $("#loads").html(status);
            },
            error: function () {
                console.log('something went wrong - debug it!');
            }
        });
    }