【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
相关推荐
Xの哲學3 分钟前
深入剖析Linux文件系统数据结构实现机制
linux·运维·网络·数据结构·算法
Wpa.wk9 分钟前
性能测试工具 - JMeter工具组件介绍二
运维·经验分享·测试工具·jmeter·自动化·json
朝阳58113 分钟前
Ubuntu 22.04 安装 Fcitx5 中文输入法完整指南
linux·运维·ubuntu
开开心心就好16 分钟前
图片格式转换工具,右键菜单一键转换简化
linux·运维·服务器·python·django·pdf·1024程序员节
永远在Debug的小殿下19 分钟前
wsl安装Ubuntu and ROS2
linux·运维·ubuntu
❀͜͡傀儡师20 分钟前
docker一键部署HFish蜜罐
运维·docker·容器
DO_Community32 分钟前
DigitalOcean容器注册表推出多注册表支持功能
服务器·数据库·docker·kubernetes
dnpao1 小时前
linux onlyoffice服务向docker容器中添加中文字体
linux·运维·docker
回忆是昨天里的海1 小时前
k8s暴露服务-Ingress环境部署
云原生·容器·kubernetes
AOwhisky1 小时前
Linux防火墙管理指南
linux·运维·服务器