今天在k8s上部署gitlab,由于是helm chart方式部署,StorageClass示例文件上没有说明如何更改StorageClass类型,只是说明了,如果不填写StorageClass 类型,将会是默认的存储类型。

如何查看k8s上的存储类型

本人环境是阿里云ack

$ kubectl get storageclass

NAME                       PROVISIONER                       RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
alibabacloud-cnfs-nas      nasplugin.csi.alibabacloud.com    Delete          Immediate              true                   171d
alicloud-disk-available    diskplugin.csi.alibabacloud.com   Delete          Immediate              true                   171d
alicloud-disk-efficiency   diskplugin.csi.alibabacloud.com   Delete          Immediate              true                   171d
alicloud-disk-essd         diskplugin.csi.alibabacloud.com   Delete          Immediate              true                   171d
alicloud-disk-ssd          diskplugin.csi.alibabacloud.com   Delete          Immediate              true                   171d
alicloud-disk-topology     diskplugin.csi.alibabacloud.com   Delete          WaitForFirstConsumer   true                   171d
# ALLOWVOLUMEEXPANSION字段表示是否可以扩展卷,就是pv

修改k8s上的默认存储类型

# 取消默认存储 只要把他的值改为false即可
$ kubectl patch storageclass alibabacloud-cnfs-nas -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

验证默认存储类型

$ kubectl get storageclass

NAME                              PROVISIONER                       RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
alibabacloud-cnfs-nas (default)   nasplugin.csi.alibabacloud.com    Delete          Immediate              true                   171d
alicloud-disk-available           diskplugin.csi.alibabacloud.com   Delete          Immediate              true                   171d
alicloud-disk-efficiency          diskplugin.csi.alibabacloud.com   Delete          Immediate              true                   171d
alicloud-disk-essd                diskplugin.csi.alibabacloud.com   Delete          Immediate              true                   171d
alicloud-disk-ssd                 diskplugin.csi.alibabacloud.com   Delete          Immediate              true                   171d
alicloud-disk-topology            diskplugin.csi.alibabacloud.com   Delete          WaitForFirstConsumer   true                   171d

参考:
改变默认 StorageClass

GitLab Helm Chart
存储指南

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐