0
点赞
收藏
分享

微信扫一扫

云原生微服务第六章之K8s常用命令

一、kubectl添加补全功能

yum install bash-completion
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> /etc/profile
source /etc/profile

二、其他常用命令

get /delete/describe/logs/exec/apply/top/cluster-info/edit/cordon/uncordon/drain/taint/api-resources/config

kubectl get po -A -o wide
kubectl get deploy -A -o wide
kubectl get po calico-node-ftgtv -n kube-system -o json
kubectl get po calico-node-ftgtv -n kube-system -o yaml
kubectl descripe pods calico-node-qfjrc -n kube-system
kubectl logs pod名 -n kube-system
kubectl delete pods pod名 -n kube-system
kubectl exec -it pods bash -n kube-system
kubectl apply -f xx.yml
kubectl explain service.spec.type # 命令说明
kubectl cluster-info dump
kubectl top node
kubectl edit po calico-node-ftgtv -n kube-system
kubectl cordon 10.0.7.21 # 标记不被调度
kubectl uncordon 10.0.7.21 # 取消不被调度
kubectl drain 10.0.7.21 # 驱逐node上的pod
kubectl taint # 标记污点
kubectl api-resources # api资源
kubectl api-versions # api资源的版本
kubectl config view # 查看kube-config配置

举报

相关推荐

0 条评论