0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GKEでPersistentVolumeClaimを作成してもPendingで PersistentVolumeが作られない

Posted at

はじめに

以下の書籍を読んでいてうまくいかない箇所があったのでまとめます

問題

$ kubectl apply -f volumesources/bookinfo-pvc.yaml

PVCを作ると自動でPVの割り当てが行われるとのことでしたが以下のコマンドをするとうまく行っていませんでした

$ kubectl get pv
何も表示されない

$ kubectl get pvc
Pendingから変わらない

解決方法

こちらの記事を読んでディスク作成してからPVCとPVを作るyamlを作成しました

/volumesources/bookinfo-pvc2.yaml
apiVersion: v1 
kind: PersistentVolume 
metadata: 
  name: bookinfo
spec: 
  capacity: 
    storage: 200Mi
  accessModes: 
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: cache 
  gcePersistentDisk: 
    pdName: bookinfo
    fsType: pd-balanced
--- 
apiVersion: v1 
kind: PersistentVolumeClaim 
metadata: 
  name: bookinfo-pvc
spec: 
  accessModes: 
    - ReadWriteOnce
  storageClassName: cache 
  resources: 
    requests: 
      storage: 200Mi

またapplyでdiskがないと怒られたので以下のコマンドで確認しました
間違ったリージョンで作成していたのが原因だと気づけました

gcloud compute disks list --project cloudnative-cicd-218

NAME                                      LOCATION                   LOCATION_SCOPE  SIZE_GB  TYPE         STATUS
bookinfo                                  northamerica-northeast1-b  zone            10       pd-balanced  READY
gke-cluster01-default-pool-a7ff5e82-25ch  northamerica-northeast1-b  zone            100      pd-balanced  READY
gke-cluster01-default-pool-a7ff5e82-5bpk  northamerica-northeast1-b  zone            100      pd-balanced  READY
gke-cluster01-default-pool-a7ff5e82-7b47  northamerica-northeast1-b  zone            100      pd-balanced  READY

おわりに

とりあえず作成はできましたが、その後の手順ですこしPVC周りを手直しする必要がありそうです

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?