【问题标题】:ReadWriteMany storage on Google Kubernetes Engine for StatefulSets用于 StatefulSets 的 Google Kubernetes Engine 上的 ReadWriteMany 存储
【发布时间】:2019-06-10 20:04:47
【问题描述】:

我使用 NFS 将 ReadWriteMany 存储挂载到 Google Kubernetes Engine 上的部署中,如以下链接所述-

https://medium.com/platformer-blog/nfs-persistent-volumes-with-kubernetes-a-case-study-ce1ed6e2c266

但是,我的特定用例(用于快照的弹性搜索生产集群)需要将 ReadWriteMany 卷安装在有状态集上。 在使用之前为有状态集创建的 NFS 卷时,不会为有状态集的不同副本配置卷。

有什么方法可以克服这个问题或我可以使用任何其他方法吗?

【问题讨论】:

    标签: 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-15
      • 2020-12-09
      • 1970-01-01
      • 2017-03-26
      • 2016-06-01
      • 2021-11-10
      • 2017-10-10
      相关资源
      最近更新 更多