kubernetes常用命令二

1、查看命令
kubectl get pod/deployment/service/namespace    #资源类查看
kubectl get pod -o wide    #资源类详细查看
kubectl describe pod pod_name    #单一详细查看(最详尽)
 
2、常用命令
kubectl create    #创建
kubectl run    #运行
kubectl replace    #更新
kubectl delete    #删除
kubectl edit    #编辑
kubectl patch    #补丁
kubectl logs    #查看日志
 
3、结合配置文件使用
kubectl apply -f yml_file    #创建、运行、更新、编辑、补丁    
kubectl delete -f yum_file    #删除
 
4、定义node(标记label)
kubectl label node k8s-node1 disktype=ssd    #将k8snode1定义为ssd节点
kubectl get node --show-labels    #查看label
kubectl label node k8s-node1 disktype-    #删除label disktype
 
5、版本记录与回滚
kubectl apply -f httpd.v1.yml --record    #--record:将命令记录到revision中
kubectl rollout history deployment httpd    #查看revision历史记录
kubectl rollout undo deployment httpd --to-revision=1    #回滚到指定版本
 
6、chart部分命令
helm list    #查看已安装的release
helm status <release_name>    #查看具体release的状态
helm upgrade    #升级release
helm history <release_name>   #查看release版本
helm rollback <release_name> <num>    #回滚release版本
helm create mychart    #创建自己chart模板
helm lint mychart   #检测chart语法,报告错误及给出建议
helm install --dry-run mychart --debug     #模拟安装并输出每个模板生成的yaml内容
 
 
posted @ 2020-02-17 21:05  jayce9102  阅读(155)  评论(0编辑  收藏  举报