-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s-debug-cluster
54 lines (40 loc) · 1.8 KB
/
k8s-debug-cluster
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#DEBUG CLUSTER
kubectl get all
kubectl get cs
kubectl get cronjob
kubectl cluster-info
kubectl config view
#KUBE CONFIG
$HOME/.kube/config
#for users and secrets
kubectl describe secret
#check the k8s system
kubectl get pods --namespace=kube-system
It should show something like:
NAME READY STATUS RESTARTS AGE
etcd-docker-for-desktop 1/1 Running 0 1d
kube-apiserver-docker-for-desktop 1/1 Running 0 1d
kube-controller-manager-docker-for-desktop 1/1 Running 0 1d
kube-dns-6f4fd4bdf-kqqkk 3/3 Running 0 1d
kube-proxy-chz7r 1/1 Running 0 1d
kube-scheduler-docker-for-desktop 1/1 Running 0 1d
#main logs to check
#Master
/var/log/kube-apiserver.log - API Server, responsible for serving the API
/var/log/kube-scheduler.log - Scheduler, responsible for making scheduling decisions
/var/log/kube-controller-manager.log - Controller that manages replication controllers
#Worker Nodes
/var/log/kubelet.log - Kubelet, responsible for running containers on the node
/var/log/kube-proxy.log - Kube Proxy, responsible for service load balancing
#TO-DO build the grep -e command with the list of kubernetes common errors to fish
grep -R -e "error|critical|warning" /var/log/kube*
#get cluster nodes
kubectl get nodes
#describe cluter node
kubectl describe node docker-for-desktop
#describe the events for a pod
kubectl describe pod my-nginx | grep -A 3 Events
#check resources
kubectl get pod -o go-template='{{range.status.containerStatuses}}{{"Container Name: "}}{{.name}}{{"\r\nLastState: "}}{{.lastState}}{{end}}' pod-name
#check a replication controller
kubectl describe rc ${CONTROLLER_NAME}