简体   繁体   English

减少 Kubernetes 持久卷

[英]Reduce kubernetes Persistent Volumes

I am using multiple apps on kubernetes and all are configured with pd-ssd volume.我在 kubernetes 上使用多个应用程序,并且所有应用程序都配置了pd-ssd卷。 Some deployments are running on big volume with less data.一些部署以较少的数据在大容量上运行。 So i wanted to reduce that volume of the pods.所以我想减少豆荚的体积。 I have worked with increase volumen and it was worked.我曾与增加卷一起工作,它奏效了。 But i can't reduce the space of the volume.但我不能减少体积的空间。

Steps i did.我做的步骤。 Current size is 100Gi, I want to resize it to 30Gi.当前大小为 100Gi,我想将其调整为 30Gi。

  1. Scaling down the application and pod.缩小应用程序和 pod。
  2. edit pvc to reduce the size of volume.编辑 pvc 以减小体积大小。
k edit pvc my-pvc

I got the following error when I save the changes.保存更改时出现以下错误。

error: persistentvolumeclaims "my-pvc" is invalid A copy of your changes has been stored to "/tmp/kubectl-edit-4ivk1.yaml" error: Edit cancelled, no valid changes were saved.错误:persistentvolumeclaims“my-pvc”无效您的更改副本已存储到“/tmp/kubectl-edit-4ivk1.yaml”错误:编辑已取消,未保存有效更改。

But i can not able to save the changes for reduce volume size.但是我无法保存更改以减小卷大小。

Shrinking persistent volumes is not supported in kubernetes, you can only increase it. kubernetes支持缩小持久卷,您只能增加它。 resizing-persistent-volumes-using-kubernetes 使用 kubernetes 调整持久卷大小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM