How to Optimizing OpenShift Storage

If the storage always full, before purchasing disks directly maybe we should check here first.

Check Linux Machine and Find Large File

Check each node and find bigger file

oc debug node/<nodename>
chroot /host
df -h
lsblk
du -a /dir/ | sort -n -r | head -n 20

du -a /dir/ | sort -n -r | head -n 20 showing top 20 files from big to small

Automatically pruning images

We could create a cronjob to pruning unnecessary images automatically. The cronjob probably looks like this.
在这里插入图片描述
Official Doc

Usually the cronjob created followed by official doc will be not be mistaken. But just check it in case.

The command to check cronjob:

oc get cronjob -A -o yaml

Check the Storage Class and Make Sure pv Config Correctly

The command to check storage class

oc get storageclass -o yaml

After that, you will know it is internal storage or external.

We can go “Logging” to see if pv config correctly. Of course the precondition is the cluster already installed OpenShift Logging and Elasticsearch

Make sure the ClusterLogging CR binds with pvc

在这里插入图片描述

oc exec -c elasticsearch $es_pod -- ls -lR /elasticsearch/persistent/logging-es/data/logging-es/nodes/0/indices/$index

Config Log Curator

Precondition : You already installed OpenShift Logging and Elasticsearch

We can edit Cluster Logging CR to config curator

oc edit clusterlogging instance
apiVersion: "logging.openshift.io/v1"
kind: "ClusterLogging"
metadata:
  name: "instance"

...

  curation:
    curator:
      schedule: 30 3 * * * 
    type: curator

Level down kubelet log level

The articles attached here.

prune by pod/crictl

sudo podman system prune -a
sudo podman system prune -a -f
crictl rmi --prune
oc adm prune images --keep-tag-revisions=3 --keep-younger-than=60m --prune-registry=false --ignore-invalid-refs=true
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值