k8s 部署 elasticsearch 存储使用StorageClass 配置文档
时间: 2023-06-07 09:12:17 浏览: 122
您好,感谢您的提问。关于 k8s 部署 elasticsearch 存储使用 StorageClass 配置文档,您可以参考以下步骤:
1. 创建一个 StorageClass,例如:
```
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast-disks
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-ssd
zone: us-central1-a
```
2. 创建一个 PVC(Persistent Volume Claim):
```
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: elasticsearch-pvc
annotations:
volume.beta.kubernetes.io/storage-class: fast-disks
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
```
3. 在 elasticsearch 的 deployment 中绑定这个 PVC:
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch
spec:
replicas: 1
template:
...
spec:
containers:
- name: elasticsearch
image: docker.io/elasticsearch:6.2.4
volumeMounts:
- name: elasticsearch-storage
mountPath: /usr/share/elasticsearch/data
volumes:
- name: elasticsearch-storage
persistentVolumeClaim:
claimName: elasticsearch-pvc
```
以上是一个简单的示例,您可以根据自己的实际情况进行修改。希望能帮到您,如有疑问请随时提出。
阅读全文