一,查看版本信息
检查错误日志
journalctl -xe
tail -f /var/log/messages
查看某个pod详细
kubectl describe pods/ --namespace=kube-system
查看某个service 详细信息
kubectl describe services/<服务名称> --namespace=kube-system
1.1 查看服务器操作系统版本
[root@master cloud]# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
1.2 查看kubernetes 版本信息
[root@master cloud]# kubectl --version
Kubernetes v1.5.2
1.3 查看etcd 版本信息
[root@master cloud]# etcdctl --version
etcdctl version: 3.2.9
API version: 2
1.4 查看flannel 版本信息
[root@node-1 ~]# flanneld -version
0.7.1
1.5 查看各组件状态信息
[root@master cloud]# kubectl get componentstatuses
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-0 Healthy {"health": "true"}
[root@master cloud]#
[root@master cloud]# kubectl get cs
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-0 Healthy {"health": "true"}
[root@master cloud]#
1.6 查看命名空间
[root@master cloud]# kubectl get namespaces
NAME STATUS AGE
default Active 1d
kube-system Active 1d
[root@master cloud]#
1.7 查看pods
[root@master cloud]# kubectl get pods --namespace=kube-system
NAME READY STATUS RESTARTS AGE
kubernetes-dashboard-350055417-wf8j1 1/1 Running 0 1h
1.8 删除 pods
语法:kubectl delete pods
kubectl delete pods kubernetes-dashboard-350055417-wf8j1 --namespace=kube-system
1.9 查看 services
[root@master cloud]# kubectl get services --namespace=kube-system
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes-dashboard 10.254.85.224 80:30943/TCP 1h
1.10 删除 service
语法:kubectl delete services
kubectl delete services kubernetes-dashboard --namespace=kube-system
1.11 查看 deployments
[root@master cloud]# kubectl get deployments --namespace=kube-system
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
kubernetes-dashboard 1 1 1 1 1h
1.12 删除deployments
语法: kubectl delete deployments
kubectl delete deployments kubernetes-dashboard --namespace=kube-system
[root@master cloud]# kubectl get nodes
NAME STATUS AGE
master NotReady 1d
node-1 Ready 1d
1.14 查看所有的pods
[root@master cloud]# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default nginx-pod 1/1 Running 0 6h
kube-system kubernetes-dashboard-350055417-wf8j1 1/1 Running 0 1h
1.15 查看pod的详细信息
语法:kubectl describe pods/
[root@master cloud]# kubectl describe pods/kubernetes-dashboard-350055417-wf8j1 --namespace="kube-system"
Name: kubernetes-dashboard-350055417-wf8j1
Namespace: kube-system
Node: node-1/10.11.3.61
Start Time: Wed, 17 Jan 2018 08:07:38 +0100
Labels: app=kubernetes-dashboard
pod-template-hash=350055417
Status: Running
IP: 172.17.0.3
Controllers: ReplicaSet/kubernetes-dashboard-350055417
Containers:
kubernetes-dashboard:
Container ID: docker://4fab3e7e09bbd80546aec6f3569b3a59723ef983356e59428879fe06e3359861
Image: docker.io/mritd/kubernetes-dashboard-amd64
Image ID: docker-pullable://docker.io/mritd/kubernetes-dashboard-amd64@sha256:377d905c758d08674fd434e567fbfb4411f64a52090d0de7f64fd70b72b2fbeb
Port: 9090/TCP
Args:
--apiserver-host=10.11.3.56:8080
State: Running
Started: Wed, 17 Jan 2018 08:07:43 +0100
Ready: True
Restart Count: 0
Liveness: http-get http://:9090/ delay=30s timeout=30s period=10s #success=1 #failure=3
Volume Mounts:
Environment Variables:
Conditions:
Type Status
Initialized True
Ready True
PodScheduled True
No volumes.
QoS Class: BestEffort
Tolerations:
No events.
1.16 查看service 详细信息
语法:kubectl describe service/
[root@master cloud]# kubectl describe service/kubernetes-dashboard --namespace="kube-system"
Name: kubernetes-dashboard
Namespace: kube-system
Labels: app=kubernetes-dashboard
Selector: app=kubernetes-dashboard
Type: NodePort
IP: 10.254.85.224
Port: 80/TCP
NodePort: 30943/TCP
Endpoints: 172.17.0.3:9090
Session Affinity: None
No events.
[root@master cloud]#