【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
相关推荐
程序员-Benothing15 分钟前
Vim编辑器从入门到精通:模式、快捷键、配置、插件
linux·运维·服务器
m0_6464299724 分钟前
Docker 完整核心知识点总结(超通俗易懂版)
运维·docker·容器
亚川楼宇自控系统数据中心厂家1 小时前
IBMS 集成管理系统:如何打通楼宇自控实现建筑一体化管控
运维
迪康Defender1 小时前
终端安全审批体系设计:如何平衡安全管控与业务连续性
运维·服务器·安全·运维开发·学习方法·业界资讯·远程工作
luo_guibin2 小时前
Linux系统下OpenSSL升级全流程,新旧版本切换
linux·运维·服务器
7177773 小时前
支持混合云的 DevOps 平台有哪些:主流方案对比与选型指南
运维·devops
看着博客敲代码3 小时前
No space left on device:服务器被 SSH 爆破到日志写满的完整排查与止血
linux·运维·服务器·安全·ssh
编程序的员3 小时前
使用OpenTelemetry来监控Rust应用
运维·rust·monitoring·opentelemetry
实战派K8S&DB3 小时前
TDSQL 核心模块与进程体系
运维·数据库·分布式·sql·mysql
Rooting++3 小时前
用友打包的APP壳子怎么获取SHA1码?
运维·服务器