【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
相关推荐
平行云PVT7 分钟前
数字孪生信创云渲染技术解析:从混合信创到全国产化架构
linux·unity·云原生·ue5·图形渲染·webgl·gpu算力
Percep_gan1 小时前
Linux中安装Redis,很详细
linux·运维·redis
heimeiyingwang1 小时前
【架构实战】云原生架构设计原则
云原生·架构
七七powerful1 小时前
运维养龙虾--AI 驱动的架构图革命:draw.io MCP 让运维画图效率提升 10 倍,使用codebuddy实战
运维·人工智能·draw.io
枕书1 小时前
实战记录:如何使用 Docker 一键部署长亭 PandaWiki 智能知识库
运维·docker·容器
feng_you_ying_li2 小时前
linux之用户的权限详解(4)
linux·运维·服务器
Cyber4K3 小时前
【妙招系列】Harbor 镜像私有仓库搭建手册
linux·云原生·容器
王码码20354 小时前
Flutter for OpenHarmony:Flutter 三方库 algoliasearch 毫秒级云端搜索体验(云原生搜索引擎)
android·前端·git·flutter·搜索引擎·云原生·harmonyos
阿里云云原生5 小时前
同学,你好!阿里云云原生 2027 实习生招聘启动
云原生
TEC_INO6 小时前
嵌入式 Linux 开发知识总结
linux·运维·服务器