CNCF
  • README.md
  • Cloud Native
    • All
      • CNCF Graduated Projects(Updated: Mar 01, 2024)
    • Kubernetes (*k8s)
      • Certifications
        • CKA, CKAD, CKS - Jan 03 2022
        • Check Badge
        • LF Certification Verify tool
        • Renew policy (Aug 2, 2021)
      • Versions
        • Native-k8s(Ubuntu) - Dec 12 2023
        • Native-k8s(CentOS) - Dec 12 2023
        • Kubernetes version graph view
        • GKE (Google Kuberntes Engine) - Jun 14 2021
      • Volumes
        • GKE PVC Resize
        • Storageclassses Performace on Managed k8s
      • Registry
        • GCR Performance
      • Observability
        • Pixie
      • Architecture
        • kubectl get componentstatuses
        • Feature Gate
        • CNCF 플랫폼 백서(White Paper)
      • Plugins
        • krew
          • custom-index
    • Service Mesh
      • Linkerd
      • Istio
        • Ambient Mesh
          • 이스티오(Istio)의 앰비언트 메시 소개
    • Security
      • Resources
        • kubesec
      • Node
        • AppArmor (under construction)
        • falco (under contruction)
        • docker-bench
      • Cluster
        • OPA / Gatekeeper (under cstrc)
        • Audit Policy
        • kube-bench
      • Container
        • trivy
    • Sustainability
      • 클라우드 네이티브의 지속가능성 랜드스케이프(Cloud Native Sustainability Landscape, v0.1)
  • Trouble Shooting
    • Cluster Build
      • kubelet is not properly working on 1.22 version
  • BLOG & NEWS (Ko, 한국어 기계 번역)
    • Blog
      • None
        • 4개의 쿠버네티스 정책(Policy) 타입(2023.03.23)
      • Member
        • Kubernetes 규정 준수를 위한 필수 가이드(2023.03.24)
        • 클라우드 네이티브 가드레일이 개발 팀에 도움이 되는 5가지 이유(2023.03.20)
        • OpenTelemetry를 이용한 Kafka 기반의 비동기 워크플로우 테스트(2023.04.04)
        • 링커드(Linkerd) 서비스 메시(Service Mesh) 소개(2023.04.06)
        • 쿠버네티스 앱의 분산 추적에 관해서 지금 알면 좋은 사항(2023.03.29)
        • CI/CD 파이프라인에 관측 가능성(observability)을 확보하는 방법(2023.05.05)
      • Community
        • 클라우드 네이티브 컴퓨팅을 위한 플랫폼 백서(White Paper) 소개(2023.04.11)
      • Project
        • KubeVela: 클라우드 네이티브 애플리케이션 및 플랫폼 엔지니어링으로 가는 길(2023.03.31)
        • Volcano Engine: Dragonfly를 통한 효과적인 이미지 배포 가속 방법(2023.04.13)
        • Weave GitOps를 Flux UI로 구현하는 법(2023.04.24)
        • 이스티오(Istio) 앰비언트(Ambient) 웨이포인트 프록시를 통한 사용 간편화(2023.04.26)
      • Ambassador
        • 오픈소스 프로젝트를 위한 ChatGPT 기반 코드 리뷰어 봇(Bot) (2023.06.06)
        • 입문자를 위한 MLOps: MLOps 시작하기 (2023.06.22)
    • News
Powered by GitBook
On this page
  • TL; DR: No impact when PVC re-claim
  • 1.Deploy pvc to standard class
  • 2.Check storageclass (which is predefined)
  • 3.Check dynamic-provisioner to storageclass
  • 4. apply it!!!
  • 5. Check pv,pvc
  • 6.Check deployment to use this pvc
  • 7. Create bundle data in the deployment(pod)
  • 8.Check bundle data in the container
  • 9. Change storage capacity from 20Gi to 30Gi and apply it
  • 10. Check again pv,pvc
  • 11. re-deploy deployment by delete
  • 12. Check data is sustained
  • DONE!!!! Successfully

Was this helpful?

  1. Cloud Native
  2. Kubernetes (*k8s)
  3. Volumes

GKE PVC Resize

TL; DR: No impact when PVC re-claim

1.Deploy pvc to standard class

$ k get pv,pvc
No resources found

2.Check storageclass (which is predefined)

k get storageclasses.storage.k8s.io
NAME                 PROVISIONER             RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
premium-rwo          pd.csi.storage.gke.io   Delete          WaitForFirstConsumer   true                   13d
standard (default)   kubernetes.io/gce-pd    Delete          Immediate              true                   13d
standard-rwo         pd.csi.storage.gke.io   Delete          WaitForFirstConsumer   true                   13d

3.Check dynamic-provisioner to storageclass

$ cat pvc-dynamic.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-dynamic
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  storageClassName: standard

4. apply it!!!

ka pvc-dynamic.yaml                                                          
persistentvolumeclaim/pvc-dynamic configured

5. Check pv,pvc

$ k get pv,pvc
NAME                                                        CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                 STORAGECLASS   REASON   AGE
persistentvolume/pvc-03943091-ba68-4491-aa53-f07481a68d32   20Gi       RWO            Delete           Bound    default/pvc-dynamic   standard                43s

NAME                                STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/pvc-dynamic   Bound    pvc-03943091-ba68-4491-aa53-f07481a68d32   10Gi       RWO            standard       45s

PVC's Capacity is lazy to update. so wait for seconds

6.Check deployment to use this pvc

$ cat deploy-pvc.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: deploy-pvc
spec:
  replicas: 1
  selector:
    matchLabels:
      app: deploy-pvc
  template:
    metadata:
      labels:
        app: deploy-pvc
    spec:
      containers:
      - name: chk-log
        image: sysnet4admin/chk-log
        volumeMounts:
        - name: pvc-vol
          mountPath: /audit
      volumes:
      - name: pvc-vol
        persistentVolumeClaim:
          claimName: pvc-dynamic

7. Create bundle data in the deployment(pod)

k run net --image=sysnet4admin/net-tools-ifn                                 
pod/net created

k get po -o wide
NAME                          READY   STATUS    RESTARTS   AGE    IP          NODE                                        NOMINATED NODE   READINESS GATES
deploy-pvc-5f958886d7-vm8sl   1/1     Running   0          2m3s   10.80.2.3   gke-node-label-dev1-pool-f1253061-c30d      <none>           <none>
net                           1/1     Running   0          16s    10.80.1.4   gke-node-label-default-pool-b9b36c6f-c9jd   <none>           <none>

k exec net -it -- /bin/bash
[root@net /]# curl 10.80.2.3
pod_n: deploy-pvc-5f958886d7-vm8sl | ip_dest: 10.80.2.3
[root@net /]# exit
exit

8.Check bundle data in the container

k exec deploy-pvc-5f958886d7-vm8sl -it -- /bin/bash                          
root@deploy-pvc-5f958886d7-vm8sl:/# ls /audit
audit_deploy-pvc-5f958886d7-vm8sl.log  lost+found
root@deploy-pvc-5f958886d7-vm8sl:/# exit

9. Change storage capacity from 20Gi to 30Gi and apply it

$ cat pvc-dynamic.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-dynamic
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 30Gi
  storageClassName: standard
  
$ ka pvc-dynamic.yaml
persistentvolumeclaim/pvc-dynamic configured

10. Check again pv,pvc

k get pv,pvc
NAME                                                        CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                 STORAGECLASS   REASON   AGE
persistentvolume/pvc-03943091-ba68-4491-aa53-f07481a68d32   30Gi       RWO            Delete           Bound    default/pvc-dynamic   standard                10m

NAME                                STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/pvc-dynamic   Bound    pvc-03943091-ba68-4491-aa53-f07481a68d32   20Gi       RWO            standard       10m

11. re-deploy deployment by delete

k delete po deploy-pvc-5f958886d7-vm8sl
pod "deploy-pvc-5f958886d7-vm8sl" deleted

12. Check data is sustained

k exec deploy-pvc-5f958886d7-jl7k5 -it -- /bin/bash
root@deploy-pvc-5f958886d7-jl7k5:/# ls /audit
audit_deploy-pvc-5f958886d7-vm8sl.log  lost+found
root@deploy-pvc-5f958886d7-jl7k5:/#

DONE!!!! Successfully

Reference:

PreviousVolumesNextStorageclassses Performace on Managed k8s

Last updated 3 years ago

Was this helpful?

Resizing Persistent Volumes using KubernetesKubernetes
Logo