k8s命令总结

来源:互联网 发布:postgresql 数据加密 编辑:程序博客网 时间:2024/05/16 02:09

查询服务信息,服务的配置文件位置

systemctl status kube-apiserver


查询帮忙 

kube-apiserver --help


指定namespace,如果不指定默认查询的数据都是default这个namespace下的数据

查询某个namespace数据

kubectl describe secret harborsecret -n namespace

查看所有namespace数据

kubectl get secret --all-namespaces


获取某个对象的详情信息

kubectl get job loomz-train-1-worker-0 -o yaml -n loomz-train-1

kubectl descibe job loomz-train-1-worker-0 -n loomz-train-1


kubectl get svc --all-namespaces

获取 dashboard kube-dns  等k8s相关组件 信息,IP、端口


设置node不可用,不参被调度

kubectl patch node xxx.xxx.xx.xx -p '{"spec":{"unschedulable":true}}'

或者:

kubectl delete node 10.101.4.2

重新创建:kubectl create -f xxx.yaml

apiVersion: v1
kind: Node
metadata:
  annotations:
    node.alpha.kubernetes.io/ttl: "0"
  labels:
    kubernetes.io/hostname: 10.101.4.2
  name: 10.101.4.2
spec:
  externalID: 10.101.4.2
  podCIDR: 10.101.12.0/24

原创粉丝点击