【Kubernetes】之常用命令

本文概述了在Kubernetes中使用kubectl命令进行关键操作,包括查询命名空间、服务、日志,管理节点和配置,以及部署、服务更新、集群状态查看等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 查询命名空间:kubectl get namespaces 或 ns
2. 查询服务名:kubectl get services 或 svc
3. 查询对应命名空间下的服务名:kubectl -n {namespace} get services 或 svc
4. 根据命名空间下某个服务的查询日志:kubectl -n {namespace} logs -f {serverName} --tail100
5. 获取节点名列表:kubectl get nodes 或 node
6. 编辑节点配置信息:kubectl edit nodes {node-name}
7. 查看节点配置信息:kubectl describe nodes {node-name}
8. 查看cm配置信息:kubectl get cm 或 configmap
9. 编辑cm配置信息:kubectl edit cm {configmap-name}
10. 查询pod(以ns为onap为例):kubectl -n onap get pods 或 pod 或 po
11. 加参数 -o wide 可显示运行节点和暴露端口:kubectl -n onap get pod -o wide
12. 查看service:kubectl get services 或 service 或 svc
13. 使用 --revision参数指定某个历史版本:kubectl rollout history deployment/nginx-deployment
14. 暂停deployment的更新:kubectl rollout pause deployment/nginx-deployment
15. 恢复deployment的更新:kubectl rollout resume deployment/ngi

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值