kubectl top pod コマンドでのメモリ使用量の計算方法
kubectl top pod コマンドの出力は、Container Service の container_memory_usage_bytes メトリックのメモリ使用量とは等しくなく、container_memory_working_set_bytes メトリックのメモリ使用量です。 計算方法は次のとおりです。
container_memory_usage_bytes = container_memory_rss + container_memory_cache + カーネルメモリ
container_memory_working_set_bytes = container_memory_usage_bytes - total_inactive_file (非アクティブなファイルページ)
container_memory_working_set_bytes は、コンテナーが実際に使用するメモリ量であり、リソース制限が設定されている場合の再起動判断の基準にもなります。