【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
相关推荐
Timememory8293 小时前
配置DNS主从服务
运维·服务器
时光不去4 小时前
java接口自动化之allure本地生成报告
运维·笔记·自动化
z202305085 小时前
Linux之vmlinux文件段布局和arm64 的链接脚本vmlinux.lds.S分析
linux·运维·服务器
北京阿法龙科技有限公司8 小时前
AR眼镜基于上下文智能识别:电力运维高效规范操作应用方案|阿法龙XR云平台
运维·ar·xr
RisunJan8 小时前
docker一键部署项目
运维·docker·容器
victory04318 小时前
K8S NFS 静态配置和动态配置 StorageClass
云原生·容器·kubernetes
运维 小白8 小时前
k8s 部署NFS和动态供应器
云原生·容器·kubernetes
luyun0202028 小时前
Windows 11操作更丝滑,绝了
java·运维·figma
wanhengidc10 小时前
全面了解云手机的安全性
运维·服务器·游戏·智能手机·云计算
hweiyu0010 小时前
Docker(K8S)容器架构教程(视频教程)
docker·架构·kubernetes