1.문제

- 클러스터에 문제가 생길 경우 [kubectl get event] 명령어로 클러스터의 문제를 확인해야함

- 문제를 결과 값이 시간순서대로 출력되지 않기때문에  문제를 한 눈에 파악하기가 어려움

 

 

 

 

2. 해결

 - kubectl get event -o yaml 명령어로 출력값들이 yaml 형식인 것을 확인 할 수 있음

 - custom-columns 라는 기능을 제공하기 때문에 시간 등 필요한 값들만 뽑은 후 시간으로 sort 하면 해결

 

3. 예제

# kubectl get event -o custom-columns=TIME:lastTimestamp,NAME:metadata.name,TYPE:type,MESSAGE:message | sort

 

[root@test-master001 ~]# kubectl get event -o custom-columns=TIME:lastTimestamp,NAME:metadata.name,TYPE:type,MESSAGE:message | sort
2021-09-10T00:16:28Z   data-imprecise-hog-mariadb-master-0.169fbf87aff6c169   Normal    no persistent volumes available for this claim and no storage class is set
2021-09-10T00:16:28Z   data-imprecise-hog-mariadb-slave-0.169fbf87b068e1b7    Normal    no persistent volumes available for this claim and no storage class is set
<nil>                  imprecise-hog-mariadb-master-0.169fbf8808c5fdd8        Warning   0/5 nodes are available: 5 pod has unbound immediate PersistentVolumeClaims.
<nil>                  imprecise-hog-mariadb-slave-0.169fbf8808caeec0         Warning   0/5 nodes are available: 5 pod has unbound immediate PersistentVolumeClaims.

+ Recent posts