$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-node1 Ready <none> 46d v1.13.1
k8s-node2 Ready <none> 46d v1.13.1
k8s-node3 Ready <none> 46d v1.13.1
$ systemctl status kube-apiserver|grep active
Active: active (running) since 三 2019-01-23 13:50:54 CST; 1 weeks 3 days ago
$ kubectl cluster-info
Kubernetes master is running at https://192.168.10.24:8443
CoreDNS is running at https://192.168.10.24:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
$ kubectl get componentstatuses
NAME STATUS MESSAGE ERROR
controller-manager Unhealthy Get http://127.0.0.1:10252/healthz: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x01\x00\x02\x02"
scheduler Healthy ok
etcd-0 Healthy {"health":"true"}
etcd-1 Healthy {"health":"true"}
etcd-2 Healthy {"health":"true"}
$ systemctl status kube-controller-manager|grep Active
Active: active (running) since 三 2019-01-23 13:34:25 CST; 1 weeks 3 days ago
$ systemctl status kube-scheduler|grep Active
Active: active (running) since 三 2019-01-23 13:50:10 CST; 1 weeks 3 days ago
curl -s http://127.0.0.1:10251/metrics
$ systemctl status docker|grep Active
Active: active (running) since 三 2019-01-23 13:50:10 CST; 1 weeks 3 days ago
$ systemctl status kubelet|grep Active
Active: active (running) since 三 2019-01-23 13:50:10 CST; 1 weeks 3 days ago
$ systemctl status kube-proxy|grep Active
Active: active (running) since 三 2019-01-23 13:50:20 CST; 1 weeks 3 days ago
[k8s@k8s-node3 ~]$ systemctl status etcd|grep active
Active: active (running) since 三 2019-01-23 13:50:44 CST; 1 weeks 3 days ago
[k8s@k8s-node1 ~]$ ETCDCTL_API=3 /opt/k8s/bin/etcdctl --endpoints=https://192.168.10.21:2379 --cacert=/etc/kubernetes/cert/ca.pem --cert=/etc/etcd/cert/etcd.pem --key=/etc/etcd/cert/etcd-key.pem endpoint health
https://192.168.10.21:2379 is healthy: successfully committed proposal: took = 1.843545ms
[k8s@k8s-node1 ~]$ ETCDCTL_API=3 /opt/k8s/bin/etcdctl --endpoints=https://192.168.10.22:2379 --cacert=/etc/kubernetes/cert/ca.pem --cert=/etc/etcd/cert/etcd.pem --key=/etc/etcd/cert/etcd-key.pem endpoint health
https://192.168.10.22:2379 is healthy: successfully committed proposal: took = 2.342839ms
[k8s@k8s-node1 ~]$ ETCDCTL_API=3 /opt/k8s/bin/etcdctl --endpoints=https://192.168.10.23:2379 --cacert=/etc/kubernetes/cert/ca.pem --cert=/etc/etcd/cert/etcd.pem --key=/etc/etcd/cert/etcd-key.pem endpoint health
https://192.168.10.23:2379 is healthy: successfully committed proposal: took = 2.265994ms
[k8s@k8s-node1 ~]$ systemctl status haproxy|grep Active
Active: active (running) since 三 2019-01-23 13:29:40 CST; 1 weeks 3 days ago
[k8s@k8s-node1 ~]$ systemctl status keepalived|grep Active
Active: active (running) since 三 2019-01-23 13:29:40 CST; 1 weeks 3 days ago
$ kubectl get pods --namespace=kube-system
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-5d94b577bb-lqp7b 1/1 Running 5 10d
calico-node-658m6 1/1 Running 7 37d
calico-node-8cpzs 1/1 Running 10 37d
calico-node-cjjmb 1/1 Running 5 37d
$ calicoctl get nodes|grep -v NAME
k8s-node1
k8s-node2
k8s-node3
# calicoctl node status
Calico process is running.
IPv4 BGP status
+----------------+-------------------+-------+------------+-------------+
| PEER ADDRESS | PEER TYPE | STATE | SINCE | INFO |
+----------------+-------------------+-------+------------+-------------+
| 192.168.10.22 | node-to-node mesh | up | 2019-01-23 | Established |
| 192.168.10.23 | node-to-node mesh | up | 2019-01-23 | Established |
+----------------+-------------------+-------+------------+-------------+
IPv6 BGP status
No IPv6 peers found.
$ kubectl get pods -n kube-system|grep -v NAME|grep coredns
coredns-fff89c9b9-5h9fv 1/1 Running 4 35d
coredns-fff89c9b9-pdd4w 1/1 Running 6 36d
coredns-fff89c9b9-wm2zh 1/1 Running 7 44d
创建检测使用的pod,为了方便,直接定义为运行时间在十年以上:
$ cat busybox-check.yaml
apiVersion: v1
kind: Pod
metadata:
name: busybox-check
spec:
containers:
- image: busybox
name: busybox-check
command: [ "sleep", "360000000" ]
[k8s@k8s-node1 ~]$ kubectl create -f busybox-check.yaml
ping kubernetes服务名一个数据包:
$ kubectl exec busybox-check -- ping -c 1 kubernetes
PING kubernetes (10.254.0.1): 56 data bytes
64 bytes from 10.254.0.1: seq=0 ttl=64 time=0.074 ms
--- kubernetes ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.074/0.074/0.074 ms