【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
相关推荐
Asuncion00728 分钟前
K8s控制器详解:从原理到实战
docker·容器·kubernetes
小蜗快跑丶35 分钟前
内网构建https
运维·服务器
做运维的阿瑞41 分钟前
DevOps 生命周期完全指南
运维·容器·devops
BullSmall1 小时前
Ansible三大Web界面方案全解析
运维·ansible
东城绝神1 小时前
《Linux运维总结:基于ARM64+X86_64架构CPU使用docker-compose一键离线部署mongodb 7.0.22容器版分片集群》
linux·运维·mongodb·架构·分片集群
Akamai中国1 小时前
运维逆袭志·第4期 | 安全风暴的绝地反击 :从告警地狱到智能防护
运维·人工智能·云计算·云服务·云存储
研究司马懿2 小时前
【GitOps】Argo CD app of apps
大数据·开发语言·elasticsearch·搜索引擎·云原生·argocd·gitops
塔能物联运维2 小时前
物联网运维中的容器化服务部署与弹性扩展技术
运维·物联网
Jtti2 小时前
什么是DNS负载均衡?提升网站稳定性与容错性的方法
运维·负载均衡
王忘杰3 小时前
K8S Kubernetes集群部署
kubernetes