【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
相关推荐
xuanyu2223 分钟前
Linux常用指令
linux·运维·人工智能
KookeeyLena544 分钟前
云手机可以挂在服务器使用吗?
运维·服务器·智能手机
老汉忒cpp1 小时前
手动部署并测试内网穿透(ssh 和 nginx)
运维·服务器
hardStudy_h1 小时前
Linux——常用系统设置和快捷键操作指令
linux·运维·服务器
我叫啥都行2 小时前
计算机基础知识复习9.7
运维·服务器·网络·笔记·后端
骅青2 小时前
kubernetes调度2
容器·kubernetes
沛沛老爹2 小时前
服务监控插件全览:提升微服务可观测性的利器
微服务·云原生·架构·datadog·influx·graphite
qq 1778036223 小时前
智能新时代,游戏盾守护顺畅体验
运维·服务器·网络·游戏·云计算·ddos·ip
huaqianzkh3 小时前
了解华为云容器引擎(Cloud Container Engine)
云原生·架构·华为云
Alone80463 小时前
K8s中HPA自动扩缩容及hml
云原生·容器·kubernetes