【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
相关推荐
老兵发新帖18 小时前
ubuntu添加用户完整命令
linux·运维·ubuntu
阿里云云原生18 小时前
从这张年度技术力量榜单里,看见阿里云从云原生到 AI 原生的进化能力和决心
云原生
snpgroupcn18 小时前
大规模 SAP 转型综合方案:S/4HANA 迁移、数据迁移与系统集成
运维·制造
阿里云云原生18 小时前
2025 智能体工程现状
云原生·llm
❀͜͡傀儡师19 小时前
运维问题排查笔记:磁盘、Java进程与SQL执行流程
java·运维·笔记
是一个Bug19 小时前
云原生架构
云原生·架构
m0_4887776519 小时前
Docker容器技术场景化操作实战及网络模式部署
运维·docker·容器·网络模式
2501_9399090519 小时前
Docker
运维·docker·容器
嘻哈baby19 小时前
Linux进程排查实战:strace和lsof救命指南
运维
vortex519 小时前
Linux 处理以 Null 字节分隔内容的文件
linux·运维·服务器