集群状态检查(Master节点):

    image.png

    [root@Master /]# kubectl get cs (查看集群健康状态)
    NAME STATUS MESSAGE ERROR
    scheduler Healthy ok
    controller-manager Healthy ok
    etcd-0 Healthy {“health”:”true”}

    [root@Master /]# kubectl version —short (查看集群版本)
    Client Version: v1.18.0
    Server Version: v1.18.0

    [root@Master /]# kubectl cluster-info (查看集群信息

    Kubernetes master is running at https://192.168.2.24:6443
    KubeDNS is running at https://192.168.2.24:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

    To further debug and diagnose cluster problems, use ‘kubectl cluster-info dump’.、

    [root@Master /]# kubectl get node (查看node信息)
    NAME STATUS ROLES AGE VERSION
    ck-master NotReady master 47m v1.18.0(上条命令表示master节点是NotReady的,通过看日志发现是缺少网络插件)

    [root@Master /]# tail -f /var/log/messages
    Jul 27 17:29:24 k8s4 kubelet: W0727 17:29:24.559226 10459 cni.go:237] Unable to update cni config: no networks found in /etc/cni/net.d
    Jul 27 17:29:27 k8s4 kubelet: E0727 17:29:27.641272 10459 kubelet.go:2187] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
    (PS:我们能够在master上查看集群信息,主要就是因为家目录下的.kube/config文件(admin.conf),也就是将这个文件拷贝到别的主机后,别的主机也可以使用查看集群的相关信息,并不建议这么做,存在一定的风险性)

    image.png

    image.png
    可以用命令让kubernetes具备命令行补全功能,提高使用效率

    “yum install bash-completion -y”

    相关链接:https://www.cnblogs.com/ccbloom/p/11320407.html