【Kubernetes】之常用命令

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/nginx-deployment
16. 查看集群信息:kubectl cluster-info
17. 查看各组件信息:kubectl get componentstatuses 或 cs
18. 查看当前所有的pod:kubectl get pods 或 po
19. 查看pods所在的运行节点:kubectl get pods -o wide
20. 查看pods定义的详细信息:kubectl get pods -o yaml
21. 查看Replication Controller信息:kubectl get rc 或 replicationcontrollers
22. 查看daemonset信息:kubectl get daemonsets 或 daemonset
23. 查看deployments信息:kubectl get deployments 或 deploy
24. 按名称选择pod:kubectl get pods --selector name=redis
25.查看命名空间资源使用情况:kubectl top resource --namespace={namespace-name} --sort=cpu --sort=memory
 

  • 8
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值