pod 具有未绑定的即时 PersistentVolumeClaims ECK(Kubernetes 上的 Elasticsearch) [英] pod has unbound immediate PersistentVolumeClaims ECK (Elasticsearch on Kubernetes)

查看:36
本文介绍了pod 具有未绑定的即时 PersistentVolumeClaims ECK(Kubernetes 上的 Elasticsearch)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 kubernetes 上部署弹性

解决方案

pod 具有未绑定的即时 PersistentVolumeClaims

上述错误意味着没有可以绑定到 PersistentVolumeClaimpersistentVolume.默认情况下,local-storage 不会真正动态地创建 persistentVolume.

要使用local-storage存储类的动态配置机制,您需要配置local-storage类,以便它可以配置persistentVolume>.检查此讨论 Kubernetes:创建动态本地卷以自动为 PVC 分配 PV 的最佳做法是什么?.

或者不使用存储类的动态配置机制,您需要使用 hostPath 创建一个 persistentVolume,它可以绑定到 PersistentVolumeClaim.但是这不是用于生产用途的推荐解决方案.在此处查看本指南.

PersistentVolumeClaim 将根据弹性 yaml 中的 volumeClaimTemplates 自动创建.因此你不应该创建一个PersistentVolumeClaim.

由于 nodeSets 计数为 2,因此创建了两个 PersistentVolumeClaim.所以你需要创建两个persistentVolume.

apiVersion: v1种类:持久卷元数据:名称:elasticsearch-data1标签:类型:本地规格:存储类名称:标准容量:存储:10Gi访问模式:- 读写一次主机路径:路径:/mnt/data"---api版本:v1种类:持久卷元数据:名称:elasticsearch-data2标签:类型:本地规格:存储类名称:标准容量:存储:10Gi访问模式:- 读写一次主机路径:路径:/mnt/data"

I am trying to deploy elastic on kubernetes https://www.elastic.co/guide/en/cloud-on-k8s/current/index.html on a local minikube cluster. I have already installed the operator.

When i apply the elasticsearch cluster below, i get the following pod error:

running "VolumeBinding" filter plugin for pod "data-es-es-default-0": pod has unbound immediate PersistentVolumeClaims

volume/claim:

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 get pvc

解决方案

pod has unbound immediate PersistentVolumeClaims

Above error means there is no persistentVolume that can be bound to the PersistentVolumeClaim. By default local-storage does not really create a persistentVolume dynamically.

To use dynamic provisioning mechanism of local-storage storage class you need to configure the local-storage class so that it can provision the persistentVolume. Check this discussion Kubernetes: What is the best practice for create dynamic local volume to auto assign PVs for PVCs?.

Alternatively without using dynamic provisioning mechanism of a storageclass you need to create a persistentVolume using hostPath which can be bound to the PersistentVolumeClaim.But this is not a recommended solution for production usage. Check this guide here.

PersistentVolumeClaim will be automatically created based on volumeClaimTemplates in the elastic yaml. Hence you should not create a PersistentVolumeClaim.

Since nodeSets count is 2 two PersistentVolumeClaim is created. So you need to create two 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"

这篇关于pod 具有未绑定的即时 PersistentVolumeClaims ECK(Kubernetes 上的 Elasticsearch)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆