1
2

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 3 years have passed since last update.

GKEのブートディスクを10GBにしてDiskPressureが発生した

Posted at

GKEのブートディスクを10GBにしてDiskPressureが発生した

Google kubernetes Engineを使ってKubernetes(K8s)クラスタを構築した際に、
ブートディスクのサイズを低く設定しすぎてDiskPressureが発生したので自戒も込めて残してておく。

TL;DR

  • GKEでistioを使ってアプリケーションを動かしたいのであれば、ブートディスクは10GBにはしないほうが良い。
  • スィートスポットは各アプリケーションで見つけるべき。

環境

  • ブートディスクのサイズを10GB
afdasfasdgsdafjerou.png
  • istioを有効にする
sahdjfashdfasdfasdf.png

作成されたクラスタ。

$ gcloud container clusters list
NAME     LOCATION           MASTER_VERSION  MASTER_IP        MACHINE_TYPE   NODE_VERSION    NUM_NODES  STATUS
cluster  asia-northeast1-a  1.14.10-gke.17  xxx.xxx.xxx.xxx  n1-standard-1  1.14.10-gke.17  3          RUNNING

istioのサンプルアプリをdeploy

istioのgetting startedに従う。

ダウンロード。

$ curl -L https://istio.io/downloadIstio | sh -
$ cd istio-1.5.0

manifestのapply。

$ istioctl manifest apply --set profile=demo

- Applying manifest for component Base...
✔ Finished applying manifest for component Base.
- Applying manifest for component Pilot...
✔ Finished applying manifest for component Pilot.
  Waiting for resources to become ready...
  Waiting for resources to become ready...
  Waiting for resources to become ready...
  Waiting for resources to become ready...
  Waiting for resources to become ready...
  Waiting for resources to become ready...
  Waiting for resources to become ready...
  Waiting for resources to become ready...
  Waiting for resources to become ready...
- Applying manifest for component IngressGateways...
- Applying manifest for component EgressGateways...
- Applying manifest for component AddonComponents...
✔ Finished applying manifest for component EgressGateways.
✔ Finished applying manifest for component IngressGateways.
✔ Finished applying manifest for component AddonComponents.
✔ Installation complete

labelの追加。

$ kubectl label namespace default istio-injection=enabled
$ kubectl get namespace -L istio-injection

NAME              STATUS   AGE     ISTIO-INJECTION
default           Active   4h17m   enabled
istio-system      Active   4h17m   disabled
kube-node-lease   Active   4h17m
kube-public       Active   4h17m
kube-system       Active   4h17m

アプリケーションのデプロイ。

$ kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created

$ kubectl get services
NAME          TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)    AGE
details       ClusterIP   10.24.6.27    <none>        9080/TCP   32s
kubernetes    ClusterIP   10.24.0.1     <none>        443/TCP    4h18m
productpage   ClusterIP   10.24.6.168   <none>        9080/TCP   31s
ratings       ClusterIP   10.24.1.121   <none>        9080/TCP   32s
reviews       ClusterIP   10.24.11.5    <none>        9080/TCP   31s

動作確認。

$ kubectl exec -it $(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}') -c ratings -- curl productpage:9080/productpage | grep -o "<title>.*</title>"
<title>Simple Bookstore App</title>

node の状態を確認

DiskPressureが発生している。
dgfhfdghsssghfda.png

nodeのディスク容量を確認する

GKEはGCE(Google Compute Engine)のインスタンス上に作られる為、SSHして調べる。
10GB設定したが、/dev/sda1には5.7GBと表示されている。

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.2G  691M  530M  57% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           1.9G  1.7M  1.9G   1% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs           1.0M  188K  836K  19% /etc/machine-id
tmpfs           256K     0  256K   0% /mnt/disks
tmpfs           1.9G     0  1.9G   0% /tmp
overlayfs       1.0M  188K  836K  19% /etc
/dev/sda8        12M   28K   12M   1% /usr/share/oem
/dev/sda1       5.7G  3.8G  2.0G  66% /mnt/stateful_partition
tmpfs           1.0M  132K  892K  13% /var/lib/cloud

/dev/sda1/varなどで使われるFilesystem。

$ df -T /var/
Filesystem     Type 1K-blocks    Used Available Use% Mounted on
/dev/sda1      ext4   5971884 3904764   2050736  66% /var

/var以下で一番使っているのは/var/lib/docker

$ sudo du --max-depth=1 -h  /var/lib/docker
32M     /var/lib/docker/containers
76K     /var/lib/docker/network
4.0K    /var/lib/docker/tmp
7.4M    /var/lib/docker/image
4.0K    /var/lib/docker/runtimes
20K     /var/lib/docker/plugins
28K     /var/lib/docker/volumes
20K     /var/lib/docker/builder
4.0K    /var/lib/docker/trust
72K     /var/lib/docker/buildkit
8.3G    /var/lib/docker/overlay2
4.0K    /var/lib/docker/swarm
8.3G    /var/lib/docker

10GB設定だと、istioとアプリケーションの設定だけでDiskが枯渇してしまう。

対応方法

ストレージクラスを上げたnode poolを作成し、drain/codonなどで移設ずる。

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?