kubectl cmd
2021/5/15 10:29:27
本文主要是介绍kubectl cmd,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
kubectl get nodes #查看节点状态 kubectl get cs #kubectl检查组件健康状态 kubectl get pods kubectl get all kubectl get svc $serviceames kubectl get ep kubectl create -f nginx.yaml kubectl delete -f nginx-deployment.yaml kubectl run nginx --image=nginx:1.16 --port=80 --replicas=2 kubectl expose deployment/nginx --type="NodePort" --port=80 --name=nginx #创建Service对象以将应用程序"暴露"于网络中 kubectl get pods -l app=nginx #获取所有匹配app: nginx标签的Pod kubectl describe pod nginx-deployment-67594d6bf6-9gdvr # 查看API对象的细节 kubectl exec -it nginx-deployment-5c678cfb6d-lg9lw -n $namespace-- /bin/bash kubectl exec -it <pod-name> -n <namespace> -- /bin/bash 进入pod kubectl exec -it <pod-name> -n <namespace> -c <container-name> -- /bin/bash 进入pod中指定容器 # 集群资源查询 kubectl get cs # 查看集群状态 kubectl get nodes # 查看集群节点信息 kubectl get ns # 查看集群命名空间 kubectl get svc -n kube-system # 查看指定命名空间的服务 kubectl get pod <pod-name> -o wide # 查看Pod详细信息 kubectl get pod <pod-name> -o yaml # 以yaml格式查看Pod详细信息 kubectl get pods # 查看资源对象,查看所有Pod列表 kubectl get rc,service # 查看资源对象,查看rc和service列表 kubectl get pod,svc,ep --show-labels # 查看pod,svc,ep能及标签信息 kubectl get all --all-namespaces # 查看所有的命名空间 kubectl cluster-info # 查看资源对象 Kubectl get nodes -o wide 查看节点 kubectl get pods -n <namespace> -o wide 查看pod kubectl get svc -n <namespace> -o wide 查看service kubectl get ingress -n <namespace> -o wide 查看ingress kubectl get deploy -n <namespace> -o wide 查看deployment kubectl get ds -n <namespace> -o wide 查看daemonsets kubectl get statefulsets -n <namespace> -o wide 查看statefulsets kubectl get pv 查看pv kubectl get pvc -n <namespace> -o wide 查看pvc kubectl get cm -n <namespace> -o wide 查看configmap kubectl get job -n <namespace> -o wide 查看job kubectl get cronjobs -n <namespace> -o wide 查看cronjob # 描述资源对象 kubectl describe node <node-name> kubectl describe pod <pod-name> -n <namespace> kubectl describe svc <svc-name> -n <namespace> kubectl describe ingress <ingress-name> -n <namespace> kubectl describe deployments <deployments-name> -n <namespace> kubectl describe ds <ds-name> -n <namespace> -o yaml kubectl describe statefulsets <statefulsets-name> -n <namespace> kubectl describe pv <pv-name> -n <namespace> kubectl describe pvc <pvc-name> -n <namespace> kubectl describe cm <configmap-name> -n <namespace> kubectl describe job <job-name> -n <namespace> kubectl describe cronjob <cronjob-name> -n <namespace> # 查看pod日志 kubectl logs <pod-name> -n <namespace> 查看当前pod中日志 kubectl logs <pod-name> -n <namespace> -c <container-name> 查看当前pod中指定容器日志 kubectl logs -f <pod-name> -n <namespace> -c <container-name> 追踪当前pod中容器日志 kubectl logs -p <pod-name> -n <namespace> -c <container-name> 查看上一次重启的容器日志 # 查看标签 kubectl get pods -n <namespace> --show-labels 查看pod的所有标签 kubectl get pods -n <namespace> -l key 只查看有这个key的pod kubectl get pods -n <namespace> -L key 查看key对应的value # 污点标签 kubectl taint node node1 node-role.kubernetes.io/master="":NoSchedule 设置node01不可调度 kubectl taint node node1 node-role.kubernetes.io/master-
这篇关于kubectl cmd的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-17zero-shot-learning-definition-examples-comparison
- 2024-06-06Package Easy(基于 NSIS 的打包exe安装包工具)使用方法-icode9专业技术文章分享
- 2024-06-06基于 casdoor 的 ELK 开源登录认证解决方案: elk-auth-casdoor-icode9专业技术文章分享
- 2024-05-29Elasticsearch慢查询日志配置
- 2024-05-29揭秘华为如此多成功项目的产品关键——Charter模板
- 2024-05-29海外IDC业务拓展的7大挑战
- 2024-05-29InLine Chat功能优化对标Github Copilot,CodeGeeX带来更高效、更直观的编程体验!
- 2024-05-29CodeGeeX 智能编程助手 6 项功能升级,在Visual Studio插件市场霸榜2周!
- 2024-05-29AutoMQ 生态集成 Apache Doris
- 2024-05-292024年IDC行业的深度挖掘:机遇、挑战与未来展望