Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Dynamic expansion of kubernetes pv

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The following is mainly used to expand the capacity of the pv created by ceph's rbd.

1. Query the rbd image corresponding to pv

Kubectl get pv pvc-name-o yaml | grep image

For example: kubernetes-dynamic-pvc-0fc6b77a-ac27-11e8-ae7c-0a580af40302

2. Get the node of the physical machine where the pod resides with the modified pv:

Kubectl get pod harbor-harbor-database-0-o wide

NAME READY STATUS RESTARTS AGE IP NODE

Harbor-harbor-database-0 1/1 Running 0 54m 10.244.1.130 vm102

3. View rbd image information:

# rbd info kubernetes-dynamic-pvc-0fc6b77a-ac27-11e8-ae7c-0a580af40302

Rbd image 'kubernetes-dynamic-pvc-0fc6b77a-ac27-11e8murae7cMur0a580af40302:

Size 8192 MB in 2048 objects

Order 22 (4096 kB objects)

Block_name_prefix: rbd_data.62226b8b4567

Format: 2

Features: layering

Flags:

Create_timestamp: Thu Aug 30 15:34:00 2018

# rbd disk-usage kubernetes-dynamic-pvc-0fc6b77a-ac27-11e8-ae7c-0a580af40302

Warning: fast-diff map is not enabled for kubernetes-dynamic-pvc-0fc6b77a-ac27-11e8-ae7c-0a580af40302. Operation may be slow.

NAME PROVISIONED USED

Kubernetes-dynamic-pvc-0fc6b77a-ac27-11e8-ae7c-0a580af40302 8192 M 676m

4. Modify the image size

Rbd resize-image kubernetes-dynamic-pvc-0fc6b77a-ac27-11e8-ae7c-0a580af40302-size 40960

5. Log in to the physical machine where pod resides, and query the mount point corresponding to pv:

Df-h | grep rbd

/ dev/rbd0 4.0G 700M 3.3G 18% / var/lib/kubelet/plugins/kubernetes.io/rbd/mounts/rbd-image-kubernetes-dynamic-pvc-0e294e02-acf9-11e8-ae7c-0a580af40302

6. Update size

Blockdev-getsize64 / dev/rbd0

Resize2fs / dev/rbd0

At this point, log in to pod and you can see that the pv volume has been expanded.

If not, consider restarting pod.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report