奶不够吃是什么原因| 胎盘1级什么意思| 拔智齿后可以吃什么| 入珠是什么意思| 婴儿蚊虫叮咬红肿用什么药| 闹代表什么生肖| 肌酐是什么| 女人大把掉头发是什么原因| 宽带m是什么意思| 人总放屁是什么原因| 美国为什么不敢打朝鲜| 中央政法委书记什么级别| 脚上为什么会长鸡眼| 胸骨疼挂什么科| maje是什么牌子| 筒骨炖什么好吃| 梦见老公出轨了是什么征兆| 心电图j点抬高什么意思| 马非读什么| 中国第一长洞是什么| 不排卵是什么原因造成| 直肠给药对小孩身体有什么影响| 吃什么可以丰胸| 什么案件才会出动便衣| 桃花是什么颜色的| 前列腺特异性抗原高是什么原因| 心肌缺血是什么意思| 现在创业做什么好| 包皮过长是什么样的| 阳历三月是什么星座| 不造是什么意思| 双肺纤维灶是什么意思| 人体是由什么组成的| 观音殿求什么| 梦到自己掉牙齿是什么预兆| 脚掌发红是什么原因| 事业编有什么好处| 麻痹是什么意思| 海参吃什么| 松鼠尾巴像什么| rng是什么意思| 吃什么有助于排便| 鱼香肉丝用什么肉| 千山暮雪结局是什么| 膝盖后面叫什么| 女生为什么会叫| 十滴水是什么| 机警是什么意思| 什么样的手相最有福气| 焗油是什么意思| 2pcs是什么意思| 繁衍的衍是什么意思| 仙人跳是什么意思| 豆绿色是什么颜色| 班草是什么意思| 伤官是什么意思| 尿道口红肿用什么药| 吃粥配什么菜| 擎什么意思| 感冒头晕吃什么药| 肾病什么东西不能吃| 脸上老是长闭口粉刺是什么原因| 为什么不娶养猫的女人| 辄是什么意思| 长春新碱是什么药| 印第安老斑鸠什么意思| 希爱力是什么药| 9.25什么星座| 宫颈纳囊是什么意思| 颈部淋巴结挂什么科| 咽炎用什么药好| 天冬氨酸氨基转移酶高是什么原因| 一夜白头是什么原因| 小孩子手脚脱皮是什么原因| 包粽子的叶子叫什么| 胶原蛋白是什么东西| 吃什么都是苦的是怎么回事| 十三点是什么意思| 什么照镜子里外不是人| 寸是什么单位| c3是什么意思| 乙肝表面抗原携带者什么意思| 肺动脉高压用什么药| 半夜胃反酸水是什么原因| 背靠背什么意思| 叒字什么意思| 端午节晚上吃什么| 排卵期和排卵日有什么区别| 大堤是什么意思| 桂味是什么| 陈皮和橘子皮有什么区别| 孩子呕吐是什么原因| 说话声音小是什么原因| 内膜薄吃什么补得最快| 爱出汗吃什么药好| 眼睛痒是怎么回事用什么药| 牙疼吃什么食物好得快| 胆固醇高不可以吃什么食物| 梦见好多人是什么意思| 肠胃炎饮食要注意什么| 吃什么减肚子上的赘肉最快| 右眼老跳是什么原因| 皮炎不能吃什么食物| 3月27日什么星座| 欲购从速什么意思| 鼻窦炎有什么症状表现| 74年属什么生肖| 胸口疼应该挂什么科| 口臭看什么科| 第二职业干点什么好呢| 黎山老母什么级别神仙| ipada1474是什么型号| 什么是有机磷农药| 协调什么意思| 南瓜子吃多了有什么副作用| 什么的手| 硅胶是什么材质| 一千年前是什么朝代| 过敏性咳嗽用什么药效果好| 腰突挂什么科| 十三是什么意思| 未亡人什么意思| 犯病是什么意思| 湿气太重吃什么| 发晕是什么原因引起的| 米糠是什么东西| 血压高什么原因| 打呼噜吃什么药最管用| 什么叫游走性关节疼痛| 吃头孢为什么不能喝酒| 3月27日什么星座| 白菜什么时候播种| 未见明显胚芽是什么意思| dw是什么意思| 10.22是什么星座| 祥五行属什么| 缺铁性贫血有什么症状| 琥珀色是什么颜色| 豆支念什么| 唐氏综合症是什么意思| 什么是空调病| 1980年是什么年| 艾灸为什么不能天天灸| 榛子是什么树的果实| 结膜炎是什么原因引起的| 什么药通便最快| 莲蓬什么季节成熟| 机械表是什么意思| 安踏是什么品牌| 盐酸舍曲林片治疗什么程度的抑郁| 4.14是什么星座| 为什么不爱我| 为什么冬吃萝卜夏吃姜| 兽中之王是什么动物| 老师的老公叫什么| 岳字五行属什么| 钟表挂在客厅什么位置好| 毒龙是什么意思啊| 惴惴不安什么意思| 小猫起什么名字好听| 右肩膀痛是什么原因| 皮是什么意思| 肾不好有什么表现| 橱窗是什么意思| 转卖是什么意思| 白子是什么东西| pdt是什么意思| 荷尔蒙爆棚是什么意思| 早上起来不晨勃是什么原因| 疤痕修复用什么药膏好| 视力sca分别代表什么| 菩提根是什么| 转氨酶是什么| 什么泉水| 梦见桥断了是什么意思| 头发少剪什么发型好看| 牛仔裤配什么鞋好看| 一个山一个鬼念什么| 什么是易经| 三维b片主治什么病| 艾滋病潜伏期有什么症状| 包袱是什么意思| 七七事变是什么生肖| 排卵期是什么时候| 女人为什么要少吃鳝鱼| 鱼油不能和什么一起吃| 头发不长是什么原因| dr什么意思| 婴儿为什么戴银不戴金| 4.22是什么星座| 双鱼座的幸运石是什么| 痤疮用什么药治最好效果最快| 什么东西最吸引蛇| 前列腺钙化有什么影响| 奥特莱斯是什么| microsd卡是什么卡| 胰岛素是什么意思| 眼屎多吃什么药| 纨绔子弟是什么意思| 围绝经期什么意思| 腿毛长的男人代表什么| 萩是什么意思| 物质是什么| 砷是什么东西| 指教是什么意思| 车票改签是什么意思| 脂膜炎是什么病| 总是打哈欠是什么原因| 怕冷的女人是什么原因| 辐射对称是什么意思| 洗耳恭听什么意思| 阴柔是什么意思| 什么茶降血糖| 旖旎风光是什么意思| 雄黄是什么东西| 甲状腺4b级是什么意思| 什么运动可以瘦脸| winbond是什么品牌| 十点是什么时辰| 蜜蜂蛰了用什么药| 火舌是什么意思| 本来无一物何处惹尘埃是什么意思| 罢免是什么意思| 复方血栓通片功效作用治疗什么病| 醋泡脚有什么好处和坏处| 李子什么颜色| 乳腺瘤是什么引起的| 血小板下降是什么原因| 驴胶补血颗粒什么时候喝最好| 1970年属什么生肖| 怎么查自己五行缺什么| 国际是什么意思| 血虚肝旺有什么症状有哪些| bbc是什么意思| 獭尾肝是什么意思| 面瘫吃什么药| 违心的话是什么意思| 花生什么时候收| 暗渡陈仓是什么生肖| 禾加末念什么| 梦见吃水饺是什么预兆| 松针是什么| 小便少是什么原因| 来例假肚子疼是什么原因| 防水逆什么意思| 什么叫脘腹胀痛| 月经淋漓不尽什么原因| 银为什么会变黑| 12岁属什么| 阴血亏虚吃什么中成药| 泄泻是什么意思| 月光石五行属什么| 右手麻木是什么原因引起的| 卡介苗为什么会留疤| 锲而不舍是什么生肖| 色盲是什么遗传方式| 打耳洞需要注意什么| 内分泌失调吃什么调理| 肾结石吃什么好| 什么叫糖化血红蛋白| 肠道紊乱的症状是什么| 类风湿吃什么药好| 2岁什么都听懂但不说话| 什么样的水花| 百度

涟源推出贫困劳动力招聘“组合套餐”

百度 金融业、服务业、政府机构的从业人员睡眠质量最差。

Validated on 25 Feb 2021 ? Last edited on 17 Jun 2025

DigitalOcean Kubernetes (DOKS) is a Kubernetes service with a fully managed control plane, high availability, and autoscaling. DOKS integrates with standard Kubernetes toolchains and DigitalOcean’s load balancers, volumes, CPU and GPU Droplets, API, and CLI.

When you need to write and access persistent data in a Kubernetes cluster, you can create and access DigitalOcean Volumes Block Storage by creating a PersistentVolumeClaim (PVC) as part of your deployment. This guide shows how to add volumes to your cluster using the Kubernetes command line tool, kubectl. To learn more about kubectl, see Overview of kubectl.

The claim can allow cluster workers to read and write database records, user-generated website content, log files, and other data that should persist after a process has completed.

When managing persistent volume claims:

  • Deleting a deployment will not automatically delete any PVCs that have been created. You’ll have to remove those manually with kubectl delete pvc.

  • If the volume is deleted before the PVC API object is removed, it may be in an inconsistent state and attempts to remove the PVC will stall or fail. See the troubleshooting instructions for a fix to try in this case.

  • If a PVC by the same name already exists, you will get an error message similar to the following:

    Error from server (AlreadyExists): error when creating "pvc.yml":
    persistentvolumeclaims "csi-pvc" already exists

    Since the volume exists, it cannot be created. The existing volume will be mounted instead.

  • Volumes created in the control panel or via the API cannot be used by your Kubernetes clusters. You must create volumes within Kubernetes in order for your PVCs to use them.

Create a Configuration File

We recommend making pods that reference volumes owned by a StatefulSet. This section shows how to create a StatefulSet to use a PVC as a volume for a pod.

The StatefulSet config file can look like this:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: my-csi-app-set
spec:
  selector:
    matchLabels:
      app: mypod
  serviceName: "my-frontend"
  replicas: 1
  template:
    metadata:
      labels:
        app: mypod
    spec:
      containers:
      - name: my-frontend
        image: busybox
        args:
        - sleep
        - infinity
        volumeMounts:
        - mountPath: "/data"
          name: csi-pvc
  volumeClaimTemplates:
  - metadata:
      name: csi-pvc
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 5Gi
      storageClassName: do-block-storage

The configuration example has:

  1. A pod template that defines how the pod gets created and the image the container uses. This example adds a pod based on the Linux BusyBox image, uses the volume named csi-pvc, and mounts it within the container at /data on the filesystem.

  2. A volumeClaimTemplates that is responsible for locating the volume by name csi-pvc. If a volume by that name does not exist, one will be created. If one already exists, then the existing volume will be mounted on the first object. This example creates a 5 GB volume that will be available to the cluster by the name csi-pvc.

The three highlighted values, name, accessModes, and storage can be customized as follows:

  1. The name must be lowercase alphanumeric values and dashes only and unique within the cluster. Within these constraints, you can name it whatever you want.

  2. accessModes must be set to ReadWriteOnce. The other parameters, ReadOnlyMany and ReadWriteMany, are not supported by DigitalOcean volumes. See the Kubernetes documentation for more about accessModes.

  3. The storage value specifies the size of the volume and can be customized to meet your needs. DigitalOcean storage values can range from 1 GB to 10,000 GB.

Use kubectl apply to create the StatefulSet with the pod and the mounted volume.

You can resize volumes through Kubernetes if the DOKS version is recent enough. To resize a volume, update the storage value of the PVC object to a new target size using kubectl edit pvc <your-pvc-name>. Alternatively, you can run:

kubectl patch pvc <your-pvc-name> -p '{ "spec": { "resources": { "requests": { "storage": "<new-size>" }}}}'

It may take a few minutes for the volume to resize or you may need to restart the application for the resize to become effective. To verify that the volume has resized, check its capacity value in the volumes list or cluster’s Kubernetes dashboard.

Note
Volumes can only be increased in size, but never decreased.

Billing for the volume begins when the object is successfully created. To end billing, you must explicitly delete the volume. Remove the PVC from your cluster before deleting the volume.

Show Volumes

Once you apply the config file to a deployment, you can see the volumes in the Resources tab of your cluster in the control panel.

Within the cluster, volumes will be identified by their names as defined in the name parameter. In the example above, the name is csi-pvc.

Regardless of what you set this name to be, the name of the volume on DigitalOcean will begin with pvc- and end with a unique identifying number, something like pvc-0213ed0abexample.

Alternatively, you can list the storage volumes associated with a cluster with the get pv command:

kubectl get pv

The output looks something like:

NAME                   CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS    CLAIM             STORAGECLASS       REASON    AGE
pvc-0213ed0abexample   5Gi        RWO            Delete           Bound     default/csi-pvc   do-block-storage             11s

Setting Permissions on Volumes

By default, the filesystem owner of a volume is root:root. If a Pod is running as a non-root user and needs to create files or directories on the volume, this will fail due to insufficient or incorrect permissions. However, the following mountOptions settings are not supported by DigitalOcean Kubernetes:

mountOptions:
- dir_mode=0777
- file_mode=0777

The solution is to create a temporary container to change the permissions/ownership of the volume’s filesystem using initContainers.

We’re going to reuse the same PVC config as described in the example above and change the pod definition.

Define the Pod

The next example persists data to a Postgres database using the volume you created. The pod’s resource definition might look like:

---
apiVersion: v1
kind: Pod
metadata:
  name: my-csi-app
spec:
  containers:
    - name: my-db
      image: postgres:latest
      volumeMounts:
      - mountPath: "/var/lib/postgresql"
        name: my-do-volume
  initContainers:
  - name: pgsql-data-permission-fix
    image: busybox
    command: ["/bin/chmod","-R","777", "/data"]
    volumeMounts:
    - name: my-do-volume
      mountPath: /data
  volumes:
    - name: my-do-volume
      persistentVolumeClaim:
        claimName: csi-pvc

This adds a pod called my-csi-app based on the latest postgres image that names the csi-pvc volume my-do-volume and mounts it within the container at /data on the filesystem. This also creates an initContainer that temporarily mounts the volume and changes the file permissions for the specified path to 777. The initContainer then deletes itself. This all happens before the volume is mounted to the container. If you use securityContext in the YAML file for your Pod, you can use chown $userid instead of chmod 777.

Example:

securityContext:
  runAsUser: 1000
  fsGroup: 2000

Check the Volume Permissions

Once the cluster has been created, you can confirm the permissions were correct by checking the log with kubectl:

kubectl logs my-csi-app

The output should look like the following:

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Troubleshooting

Warning
In addition to the cluster’s Resources tab, cluster resources (worker nodes, load balancers, and volumes) are also listed outside the Kubernetes page in the DigitalOcean Control Panel. If you rename or otherwise modify these resources in the control panel, you may render them unusable to the cluster or cause the reconciler to provision replacement resources. To avoid this, manage your cluster resources exclusively with kubectl or from the control panel’s Kubernetes page.

As mentioned above, if the volume is removed manually before the PVC API object is removed with kubectl, this can cause issues. For instance, it can cause the PVC deletion to hang and never complete. If this happens, you can try the following:

kubectl get volumeattachments

The output will look something like this:

NAME           CREATED AT
$VOLUME_NAME   2025-08-07T21:58:24Z

Use your volume’s name, displayed by the previous command, in the commands below to gather information you’ll need to try to fix the issue.

kubectl describe volumeattachments $VOLUME_NAME
kubectl edit volumeattachment $VOLUME_NAME

The edit command above will allow us to edit the PVC using a text editor. Remove the following from the volume attachment metadata section, and save your changes:

finalizers:
  external-attacher/dobs-csi-digitalocean-com

Now, you can try removing the PVC:

kubectl delete pvc csi-pvc

If those steps don’t work, you can open a ticket with support.

References

For more about managing persistent volumes see:

We can't find any results for your search.

Try using different keywords or simplifying your search terms.

经期吃什么排污血最强 男人吃什么容易生儿子 驴板肠是什么部位 肠胃感冒吃什么药最好 甲状腺去医院挂什么科
心电图伪差是什么意思 冲虎煞南是什么意思 拉黑粑粑是什么原因啊 吃凉的胃疼吃什么药 凝视是什么意思
瑛字五行属什么 718什么星座 气管炎的症状吃什么药好得快 免疫五项检查是什么 荷尔蒙是什么东西起什么作用
42天产后复查都查什么 幽门螺旋杆菌阳性什么症状 林彪为什么叛变 神经紊乱吃什么药 九浅一深什么意思
为什么吃饱了就犯困hcv9jop5ns5r.cn 肌肉疼痛吃什么药hcv8jop8ns7r.cn 脸大适合什么发型hcv8jop4ns7r.cn 1.8是什么星座hcv8jop7ns2r.cn 为什么坐月子不能吹风hcv9jop1ns4r.cn
饭圈什么意思hcv9jop4ns4r.cn 宬字五行属什么hcv8jop0ns2r.cn 伤口溃烂不愈合用什么药adwl56.com 大乌叶是什么茶hcv7jop5ns3r.cn 九月二十二是什么星座hcv7jop7ns0r.cn
鼻窦炎用什么药效果最好hcv9jop3ns3r.cn 什么叫人工智能hcv8jop1ns6r.cn 心阴虚吃什么中成药mmeoe.com 山楂不能和什么一起吃xinjiangjialails.com 什么病才吃阿昔洛韦片hcv8jop6ns3r.cn
bulova是什么牌子的手表hcv9jop7ns9r.cn 米咖色是什么颜色hcv8jop4ns6r.cn 阻生牙是什么意思shenchushe.com 遇到黄鼠狼是什么征兆hcv9jop1ns4r.cn 什么是教育hcv9jop2ns6r.cn
百度