将Compute Engine磁​​盘作为持久卷添加到Container Engine [英] Adding a Compute Engine Disk to Container Engine as persistent volume

查看:48
本文介绍了将Compute Engine磁​​盘作为持久卷添加到Container Engine的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 PersistentVolumeClaim ,如下所示:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gitlab-config-storage
  namespace: gitlab
  annotations:
    volume.beta.kubernetes.io/storage-class: fast
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi

这在Google Compute Engine中创建了一个磁盘,然后删除了声明并重新应用了它,但是这创建了一个新磁盘,我想将原始磁盘附加到我的声明中,因为其中已经包含了我已经创建的数据,有没有一种方法可以强制GKE使用特定的磁盘?

This created a Disk in Google Compute Engine, I then deleted the claim and reapplied it, but this created a new Disk, I would like to attach the original Disk to my claim as this had data in it I've already created, is there a way to force GKE to use a specific Disk?

推荐答案

通过使用持久卷声明,您要求GKE使用持久磁盘,然后始终使用相同的卷.

By using a persistent volume claim, you are asking GKE to use a persistent disk, and then always use the same volume.

但是,通过删除版权声明,您实际上已经将其销毁了.

However, by deleting the claim, you've essentially destroyed it.

如果您想继续使用它,永远不要删除该声明.

Don't delete the claim, ever, if you want to continue using it.

您可以在整个生命周期内将索赔附加到多个吊舱,并且磁盘将保持不变.删除版权声明后,它就会消失.

You can attach a claim to a multiple pods over its lifetime, and the disk will remain the same. As soon as you delete the claim, it will disappear.

此处查看获取更多信息

这篇关于将Compute Engine磁​​盘作为持久卷添加到Container Engine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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