【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
相关推荐
四岁爱上了她20 分钟前
CentOS更换yum源
linux·运维·centos
再学一丢丢34 分钟前
LVS+Keepalived+dns高可用项目架构
运维·服务器
web守墓人1 小时前
【gpt生成-总览】怎样才算开发了一门编程语言,需要通过什么测试
运维·服务器·gpt
Yawesh_best1 小时前
Immich图库本地部署与远程管理:打造你的专属照片云服务
运维
vx_33076231721 小时前
vos3000外呼系统怎么给普通用户开通播放下载录音权限?
运维·服务器·人工智能·ai·媒体
孔令飞1 小时前
如何使用Docker在本地运行一个大模型?
人工智能·云原生·go
小小坦克手2 小时前
实验不能停:docker 部署支持用户名的redis容器
运维·数据库·redis
想学好C++的oMen2 小时前
Linux环境变量
linux·运维
await 4042 小时前
Dell戴尔服务器 PowerEdge R750xs + window server2012r2 || 2016
运维·服务器
阿7_QuQ3 小时前
Mac屏幕共享怎么使用?
运维·服务器·macos