检查mysql是否安装成功的命令

发布时间: 2023-11-21 11:36 阅读: 文章来源:1MUMB1959PS

使用kubeode一键部署k8s后,我想知道k8s是否安装成功了,怎么办呢?这时候就需要使用kubectl命令了。

1、使用kubectl get nodes检查k8s是否安装成功

kubectl get nodes

上述结果中,status字段非常重要,直接显示了node的状态,必须是ready才是成功的标志。

官方网站解释如下:

节点状况

描述

Ready

如节点是健康的并已经准备好接收 Pod 则为 True;False 表示节点不健康而且不能接收 Pod;Unknown 表示节点控制器在最近 node-monitor-grace-period 期间(默认 40 秒)没有收到节点的消息

DiskPressure

True 表示节点存在磁盘空间压力,即磁盘可用量低, 否则为 False

MemoryPressure

True 表示节点存在内存压力,即节点内存可用量低,否则为 False

PIDPressure

True 表示节点存在进程压力,即节点上进程过多;否则为 False

NetworkUnavailable

True 表示节点网络配置不正确;否则为 False

2、增加-o wide参数检查nodes的ip

kubectl get nodes -o wide

-o wide

以纯文本格式输出,包含所有附加信息。对于 Pod 包含节点名。

3、简略形式

kubectl get nodes -o name

4、API查询形式,可以查到比较丰富的信息

kubectl get nodes -o yaml[root@node01 ~]# kubectl get nodes -o yamlapiVersion: v1items:- apiVersion: v1kind: Nodemetadata:annotations:node.alpha.kubernetes.io/ttl: "0"volumes.kubernetes.io/controller-managed-attach-detach: "true"creationTimestamp: "2023-06-03T06:04:53Z"labels:beta.kubernetes.io/arch: amd64beta.kubernetes.io/os: linuxkubernetes.io/arch: amd64kubernetes.io/hostname: node01kubernetes.io/os: linuxnode.kubernetes.io/node: ""name: node01resourceVersion: "4166369"uid: 26453d8f-02f9-4a83-ab92-a150dfe737d4spec:podCIDR: 100.64.1.0/24podCIDRs:- 100.64.1.0/24status:addresses:- address: 192.168.235.139type: InternalIP- address: node01type: Hostnameallocatable:cpu: "32"ephemeral-storage: "483173420666"hugepages-1Gi: "0"hugepages-2Mi: "0"memory: 131757996Kipods: "110"capacity:cpu: "32"ephemeral-storage: 524276716Kihugepages-1Gi: "0"hugepages-2Mi: "0"memory: 131860396Kipods: "110"conditions:- lastHeartbeatTime: "2023-06-03T06:05:29Z"lastTransitionTime: "2023-06-03T06:05:29Z"message: Calico is running on this nodereason: CalicoIsUpstatus: "False"type: NetworkUnavailable- lastHeartbeatTime: "2023-07-05T09:32:29Z"lastTransitionTime: "2023-06-03T06:04:53Z"message: kubelet has sufficient memory availablereason: KubeletHasSufficientMemorystatus: "False"type: MemoryPressure- lastHeartbeatTime: "2023-07-05T09:32:29Z"lastTransitionTime: "2023-06-03T06:04:53Z"message: kubelet has no disk pressurereason: KubeletHasNoDiskPressurestatus: "False"type: DiskPressure- lastHeartbeatTime: "2023-07-05T09:32:29Z"lastTransitionTime: "2023-06-03T06:04:53Z"message: kubelet has sufficient PID availablereason: KubeletHasSufficientPIDstatus: "False"type: PIDPressure- lastHeartbeatTime: "2023-07-05T09:32:29Z"lastTransitionTime: "2023-06-03T06:05:34Z"message: kubelet is posting ready statusreason: KubeletReadystatus: "True"type: ReadydaemonEndpoints:kubeletEndpoint:Port: 10250images:- names:- mysql@sha256:f57eef421000aaf8332a91ab0b6c96b3c83ed2a981c29e6528b21ce10197cd16- mysql:5.7sizeBytes: 568629848- names:- calico/node:v3.15.5sizeBytes: 437164545- names:- kubeguide/tomcat-app@sha256:7a9193c2e5c6c74b4ad49a8abbf75373d4ab76c8f8db87672dc526b96ac69ac4- kubeguide/tomcat-app:v1sizeBytes: 358241257- names:- portainer/agent@sha256:2c1abfac4937923e625be5f63a15f49a19cc4cca247c50f8746a9222023865a3- portainer/agent:2.16.2sizeBytes: 165665328- names:- calico/cni:v3.15.5sizeBytes: 108767177- names:- calico/kube-controllers:v3.15.5sizeBytes: 52865826- names:- coredns/coredns:1.9.3sizeBytes: 48803555- names:- calico/pod2daemon-flexvol:v3.15.5sizeBytes: 21894737- names:- registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.3sizeBytes: 682696nodeInfo:architecture: amd64bootID: f1efc214-e9dd-42d2-8426-978ec9161310containerRuntimeVersion: docker://20.10.9kernelVersion: 3.10.0-957.el7.x86_64kubeProxyVersion: v1.23.5kubeletVersion: v1.23.5machineID: d05dd626909f446baae658ac5fbcf0cdoperatingSystem: linuxosImage: CentOS Linux 7 (Core)systemUUID: A5076CD8-A6F3-4613-8EC0-A643AEC3CA1E- apiVersion: v1kind: Nodemetadata:annotations:node.alpha.kubernetes.io/ttl: "0"volumes.kubernetes.io/controller-managed-attach-detach: "true"creationTimestamp: "2023-06-03T06:04:53Z"labels:beta.kubernetes.io/arch: amd64beta.kubernetes.io/os: linuxkubernetes.io/arch: amd64kubernetes.io/hostname: node02kubernetes.io/os: linuxnode.kubernetes.io/node: ""name: node02resourceVersion: "4166370"uid: ac0b2b8f-0d93-414e-b0b7-65ff79056402spec:podCIDR: 100.64.0.0/24podCIDRs:- 100.64.0.0/24status:addresses:- address: 192.168..235.189type: InternalIP- address: node02type: Hostnameallocatable:cpu: "16"ephemeral-storage: "289899892666"hugepages-1Gi: "0"hugepages-2Mi: "0"memory: 65704024Kipods: "110"capacity:cpu: "16"ephemeral-storage: 314561516Kihugepages-1Gi: "0"hugepages-2Mi: "0"memory: 65806424Kipods: "110"conditions:- lastHeartbeatTime: "2023-06-03T06:08:36Z"lastTransitionTime: "2023-06-03T06:08:36Z"message: Calico is running on this nodereason: CalicoIsUpstatus: "False"type: NetworkUnavailable- lastHeartbeatTime: "2023-07-05T09:35:56Z"lastTransitionTime: "2023-06-03T06:07:59Z"message: kubelet has sufficient memory availablereason: KubeletHasSufficientMemorystatus: "False"type: MemoryPressure- lastHeartbeatTime: "2023-07-05T09:35:56Z"lastTransitionTime: "2023-06-03T06:07:59Z"message: kubelet has no disk pressurereason: KubeletHasNoDiskPressurestatus: "False"type: DiskPressure- lastHeartbeatTime: "2023-07-05T09:35:56Z"lastTransitionTime: "2023-06-03T06:07:59Z"message: kubelet has sufficient PID availablereason: KubeletHasSufficientPIDstatus: "False"type: PIDPressure- lastHeartbeatTime: "2023-07-05T09:35:56Z"lastTransitionTime: "2023-06-03T06:08:40Z"message: kubelet is posting ready statusreason: KubeletReadystatus: "True"type: ReadydaemonEndpoints:kubeletEndpoint:Port: 10250images:- names:- calico/node:v3.15.5sizeBytes: 437164545- names:- kubeguide/tomcat-app@sha256:7a9193c2e5c6c74b4ad49a8abbf75373d4ab76c8f8db87672dc526b96ac69ac4- kubeguide/tomcat-app:v1sizeBytes: 358241257- names:- calico/cni:v3.15.5sizeBytes: 108767177- names:- calico/kube-controllers:v3.15.5sizeBytes: 52865826- names:- coredns/coredns:1.9.3sizeBytes: 48803555- names:- calico/pod2daemon-flexvol:v3.15.5sizeBytes: 21894737- names:- registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.3sizeBytes: 682696nodeInfo:architecture: amd64bootID: b8343e9a-fa30-4909-99b2-b6150cfbfbd4containerRuntimeVersion: docker://20.10.9kernelVersion: 3.10.0-957.el7.x86_64kubeProxyVersion: v1.23.5kubeletVersion: v1.23.5machineID: d05dd626909f446baae658ac5fbcf0cdoperatingSystem: linuxosImage: CentOS Linux 7 (Core)systemUUID: AEB3646B-ED8E-4116-A54F-305FBB717C34kind: Listmetadata:resourceVersion: ""selfLink: ""

•••展开全文