【CKA模拟题】查找集群中使用内存最高的node节点

题干

For this question, please set this context (In exam, diff cluster name)

shell 复制代码
kubectl config use-context kubernetes-admin@kubernetes

Find the Node that consumes the most MEMORY in all cluster(currently we have single cluster). Then, store the result in the file high_memory_node.txt with the following format: cluster_name,node_name .

找出所有集群中消耗内存最多的节点(目前我们只有一个集群)。然后,将结果以以下格式存储在high_memory_node.txt文件中:cluster_name,node_name

解题思路

  1. 切换K8S集群环境
shell 复制代码
kubectl config use-context kubernetes-admin@kubernetes
  1. 查找集群中节点内存使用最多的节点,并把结果存在变量node中
shell 复制代码
node=$(kubectl top nodes --sort-by=memory --no-headers | head -n 1 | awk '{print $1}')
  1. 查找集群名称
shell 复制代码
cluster_name=$(kubectl config view --minify -o=jsonpath='{.clusters[0].name}')
  1. 并按照题目的要求把结果输出到指定文件中
shell 复制代码
echo "$cluster_name,$node" > high_memory_node.txt
相关推荐
Henry-SAP19 分钟前
AI产业迎来标准化与商业化双突破
人工智能·云原生·sap·erp
IT大白鼠21 分钟前
Docker 实战 ELKF 日志监控:容器日志全栈收集分析方案
运维·docker·容器
贝锐9 小时前
从国产化信创设备到商用安卓终端,向日葵如何帮助企业实现统一运维管理?
linux·运维·远程控制
Julien200410 小时前
调查和解决 SELinux 问题
linux·运维·服务器·网络·学习方法
报错小能手11 小时前
Kubernetes入门实战课 3
云原生·容器·kubernetes
天远Date Lab11 小时前
零信任架构实战:基于天远双人婚姻评估查询构建自动化房产按揭联合审查网关
运维·人工智能·架构·自动化
2601_9620746812 小时前
自己编译RustDesk,并将自建ID服务器和key信息写入客户端
运维·服务器
2601_9622190112 小时前
版本平滑升级架构:万象生鲜系统 V4.3.3 迭代无停机更新技术拆解
微服务·云原生·架构
小张同学a.12 小时前
Docker 容器实战 1—— docker 基础与镜像构建
linux·运维·docker·容器
大模型丫丫13 小时前
Hermes Agent:轻量级智能体框架实战指南
大数据·运维·服务器