k8s 디버깅 3단계
- kubectl get po
- kubectl describe po {pod name}
- kubectl get events
Yaml 명세서 기본
kind: Pod apiVersion: v1 metadata: name: mypod spec: containers: - image: nginx name: hwk nodeSelector: disktype: ssd |
주의사항 :
- : 다음에는 무조건 공백 문자
- 들여쓰기가 매우 중요하며 tab 을 사용해서는 안됨
kubectl get event
root@master1:~# kubectl get event LAST SEEN TYPE REASON OBJECT MESSAGE 2m30s Normal Scheduled pod/mypod Successfully assigned default/mypod to ip-172-31-4-27 2m30s Normal Pulling pod/mypod Pulling image "nginx" 2m26s Normal Pulled pod/mypod Successfully pulled image "nginx" in 3.59835338s 2m26s Normal Created pod/mypod Created container hwk 2m26s Normal Started pod/mypod Started container hwk |
kubectl describe pod {pod name}
root@master1:~# kubectl describe pod mypod Name: mypod Namespace: default Priority: 0 Node: ip-172-31-4-27/172.31.4.27 Start Time: Tue, 01 Dec 2020 12:48:27 +0000 Labels: <none> Status: Running IP: 192.168.51.203 IPs: IP: 192.168.51.203 Containers: |
bash 자동 완성기능 설정
root@ip-172-31-4-27:~# source <(kubectl completion bash) # kubectl api-탭치면 자동완성이 되는것을 확인 할 수 있다 bashrc와 bash_profile에 적용하면 재 접속 후에도 사용할 수 있다 root@ip-172-31-4-27:~# echo "source <(kubectl completion bash)" >> ~/.bashrc root@ip-172-31-4-27:~# echo "source <(kubectl completion bash)" >> ~/.bash_profile root@ip-172-31-4-27:~# echo "source <(kubectl completion bash)" >> ~ubuntu/.bash_profile root@ip-172-31-4-27:~# echo "source <(kubectl completion bash)" >> ~ubuntu/.bashrc root@ip-172-31-4-27:~# echo "source <(kubeadm completion bash)" >> ~/.bash_profile root@ip-172-31-4-27:~# echo "source <(kubeadm completion bash)" >> ~/.bashrc |
'클라우드 컴퓨팅 & NoSQL > k8s' 카테고리의 다른 글
Service (0) | 2020.12.01 |
---|---|
Object Template (--dry run 사용하기) (0) | 2020.12.01 |
Deployment (0) | 2020.12.01 |
ReplicaSet (0) | 2020.12.01 |
k8s 구성요소와 Deployment Controller (0) | 2020.12.01 |