k8s 命令总结

2018-10-11  本文已影响0人  zoluo
image

Kubernetes 常用安装和使用命令总结

导出配置文件:

## 导出proxy
  kubectl get ds -n kube-system -l k8s-app=kube-proxy -o yaml>kube-proxy-ds.yaml
  ## 导出kube-dns

  kubectl get deployment -n kube-system -l k8s-app=kube-dns -o yaml >kube-dns-dp.yaml
  kubectl get services -n kube-system -l k8s-app=kube-dns -o yaml >kube-dns-services.yaml

## 导出所有 configmap
  kubectl get configmap -n kube-system -o wide -o yaml > configmap.yaml

复杂操作命令:

### 删除kube-system 下Evicted状态的所有pod:
  kubectl get pods -n kube-system |grep Evicted| awk '{print $1}'|xargs kubectl delete pod -n kube-system

以下为维护环境相关命令:

systemctl daemon-reload
systemctl restart kubelet
上一篇下一篇

猜你喜欢

热点阅读