【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
相关推荐
IT葛大侠15 分钟前
OSPF域间路由
运维·网络·计算机网络
搬码临时工16 分钟前
有公网ip但外网访问不到怎么办?内网IP端口映射公网连接常见问题和原因
运维·服务器·网络·网络协议·tcp/ip·php·远程工作
huangyuchi.17 分钟前
【Linux】编译器gcc/g++及其库的详细介绍
linux·运维·服务器·笔记·编译器·gcc·g++
egoist20233 小时前
【Linux仓库】冯诺依曼体系结构与操作系统【进程·壹】
linux·运维·服务器·开发语言·操作系统·冯诺依曼体系结构
白总Server3 小时前
Golang 依赖注入:构建松耦合架构的关键技术
linux·运维·服务器·macos·架构·golang·xcode
sg_knight3 小时前
Eureka 高可用集群搭建实战:服务注册与发现的底层原理与避坑指南
java·spring boot·spring·spring cloud·微服务·云原生·eureka
机械心3 小时前
Docker容器使用手册
运维·docker·容器
FreeBuf_4 小时前
黑客利用GitHub现成工具通过DevOps API发起加密货币挖矿攻击
运维·github·devops
某某6 小时前
DashBoard安装使用
大数据·开发语言·kubernetes
m0_746177196 小时前
小白畅通Linux之旅-----Linux日志管理
linux·运维·服务器