【问题标题】:ReadWriteMany storage on Google Kubernetes Engine for StatefulSets用于 StatefulSets 的 Google Kubernetes Engine 上的 ReadWriteMany 存储
【发布时间】:2019-06-10 20:04:47
【问题描述】:
【问题讨论】:
标签:
elasticsearch
kubernetes
【解决方案1】:
该指南会犯一个小错误,具体取决于您如何遵循它。持久卷中定义的 [ClusterIP] 应该是“nfs-server.default...”而不是“nfs-service.default...”。 “nfs-server”是服务定义中使用的。
下面是我用于 statefulset 的一个非常简单的设置。我部署了教程中的前 3 个文件来创建 PV 和 PVC,然后使用下面的 yaml 代替作者提供的 busybox 奖励 yaml。这部署成功。如果您有麻烦,请告诉我。
apiVersion: v1
kind: Service
metadata:
name: stateful-service
spec:
ports:
- port: 80
name: web
clusterIP: None
selector:
app: thestate
---
apiVersion: apps/v1
metadata:
name: thestate
labels:
app: thestate
kind: StatefulSet
spec:
serviceName: stateful-service
replicas: 3
selector:
matchLabels:
app: thestate
template:
metadata:
labels:
app: thestate
spec:
containers:
- name: nginx
image: nginx:1.8
volumeMounts:
- name: my-pvc-nfs
mountPath: /mnt
ports:
- containerPort: 80
name: web
volumes:
- name: my-pvc-nfs
persistentVolumeClaim:
claimName: nfs