Kubernetes如何跟踪StatefulSet中哪个云磁盘连接到哪个Pod? [英] How does Kubernetes track which cloud disk is attached to which Pod in a StatefulSet?

查看:78
本文介绍了Kubernetes如何跟踪StatefulSet中哪个云磁盘连接到哪个Pod?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GKE上创建了一个StatefulSet,它预配了一堆GCE磁盘,这些磁盘连接到属于该StatefulSet的Pod.假设我将StatefulSet缩放为0:组成的Pod被销毁并且磁盘被释放.当我向上扩展时,将磁盘重新连接并安装在正确的容器内.

I created a StatefulSet on GKE, and it provisioned a bunch of GCE disks that are attached to the pods that belong to that StatefulSet. Suppose I scale the StatefulSet to 0: the constituent pods are destroyed and the disks are released. When I scale back up, the disks are reattached and mounted inside the correct pods.

我的问题是:

  • Kubernetes如何跟踪哪个GCE磁盘重新连接到哪个StatefulSet Pod?
  • 假设我要从快照还原StatefulSet Pod的PV.如何让Kubernetes使用从快照创建的磁盘而不是旧磁盘?

推荐答案

将StatefulSet缩放为0个副本时,吊舱会被破坏,但会保留持久卷和持久卷声明.与GCE磁盘的关联写在PersistentVolume对象内.当您再次放大​​RS时,会将吊舱分配给正确的PV,从而从GCE获得相同的体积.

When you scale the StatefulSet to 0 replicas, the pods get destroyed but the persistent volumes and persistent volume claims are kept. The association with the GCE disk is written inside the PersistentVolume object. When you scale the RS up again, pods are assigned to the correct PV and thus get the same volume from GCE.

要在快照还原后更改持久卷-GCE磁盘关联,您需要编辑PV对象.

In order to change the persistent volume - GCE disk association after a snapshot restore, you need to edit the PV object.

这篇关于Kubernetes如何跟踪StatefulSet中哪个云磁盘连接到哪个Pod?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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