기출 정리
Last updated
Last updated
링크
기출문제 목록
기출 문제 정리
약한것
Networkpolicy. from, to
Troubleshooting
Application Failure
get pods, svc, deploy 순서보기.
pod logs, describe 상태확인하기
pod의 label확인 후 pod와 연결되어있는 service에 selector와 일치하는지 확인
mysql pod는 그 자체로 실행하는거고 web-app 같은 곳에서 mysql에 접속(접근)할 땐 그 연결을 위한 변수가 필요하기 때문에 web-app 레벨에서만 env를 설정해줌
하지만 mysql pod에서도 비밀번호 설정은 해야함.
service의 node port가 사용자 port와 일치하지 않는 상황이 있을 수 있음.
Control Plane Failure
pod All
describe.→ controlplane 쪽 error 확인
/etc~/manifests에서 controleplane에 해당하는 yaml 파일 확인 후 수정
deploy의 sacle replica 갯수를 조절해도 실질적으로 pod 갯수에 변화가 없는 경우
get pod -A
에서 에러를 확인 후 manifests 경로의 파일들에서 오탈자들 확인
(실수)
-n 으로 kube-system 네임스페이스에 있는 pod 로그 잘 찍어보기
Worker Node Failure
[1] Fix the broken cluster
에러로그
Solution
Step1. Check the status of services on the nodes.
Step2. Check the service logs using
.
Step3. If it's stopped then start the stopped services.
Alternatively, run the command:
node의 서비스 상태(status) 확인
journalctl -u kubelet
node01이 멈춰있으니 ssh node01
로 접근 후
systemctl status containerd
로 상태 확인
systemctl status kubelet
로 상태 확인
kubelet이 inactive 상태였음. →
systemctl start kubelet
혹은 service kubelet start
로 재실행
[2]
실시간으로 로그를 계속해서 출력
journalctl -u kubelet -f
kubelet이 클라이언트 CA파일을 잘못 지정해서 파일이 존재하지 않는다라고 나오는 이슈임
sudo vi /var/lib/kubelet/config.yaml
해당 파일로 들어가서 ca 관련한 경로를 수정해야함
[3]
로그에서 fail 지점 확인.
/var/lib … config 정보와 아래 정보와 비교(port)
/etc/kubernetes/kubelet.conf
ca 관련한 경로를 수정
sudo vi /var/lib/kubelet/config.yaml
kubelet 재시작
sudo systemctl restart kubelet
Network
[1] weave 설치 문제.
service end point 확인
kubectl get services -n triton
kube-proxy 로그 확인
kubectl logs -n kube-system -l k8s-app=kube-proxy
weave 로그 확인
kubectl logs -n kube-system -l name=weave-net
weave 설치
curl -L <https://github.com/weaveworks/weave/releases/download/latest_release/weave-daemonset-k8s-1.11.yaml> | kubectl apply -f -
[2] configuration conf 경로
kube-proxy pods 로그 확인
daemonsets 확인
configmap 확인
Services & Networking
Workloads & Scheduling
etcd backup & restore(복기) → 검증까지
ETCD 를 호스팅할 시스템에 ssh 로그인
동작중인 etcd 버전과 etcdctl 툴 설치여부 확인
[etcd backup]
[etcd restore]
<data-dir-location> 은 새로운 디렉터리여야함
그리고 /etc/kubernetes/manifests/etcd.yaml 파일에서
hostPath: path 에 <data-dir-location> 를 넣어줌
[검증] : etcd 두개가 up인지 확인
아래 docker 명령어로. create가 up상태까지 되는걸 봐야함.
Node가 NotReady인데 Ready가 되도록(복기_고배점)
Node 상태 “Ready” 갯수 저장 | wc -l
사용률이 가장 높은 Pod 특정 label로 조회해서 파일로 저장
[Resource관련] pvc 생성후 pod와 pvc연동(pv는 이미 존재), pvc 용량 수정.storage(복기) storageclass, standard
storageClass의 allowVolumeExpansion 필드가 true로 설정도니 경우에만 PVC를 확장할 수 있음.
storageclass 조회 후 allowVolumeExpansion 수정
pv
생성시 해당 storageclass를 설정
그렇게 해야 allowVolumeExpansion가 열려있는 해당 storageclass로 pv를 마운트(?) 하는거니깐.
pvc
생성시에도 해당 storageclass를 설정
[Resource관련] sidecar multi containers로 sidecar의 log 확인하기(복기) re머지
기존엔 container내 emptyDir 설정하여 /var/log를 통해 sidecar로 로그 확인
Ingress 생성 후 테스트
블로그 링크 1번
[네트워크] Ingress를 생성해서 이미 생성되어 있는 서비스와 연결 후 확인 re
ingressClassName를 삭제햇는지는 모르겠네
[네트워크] Networkpolicy 생성 후 특정 namespace의 Pod로만 연결(to, from..)
[권한] ServiceAccount 생성, Role 생성, Role Binding 생성 후 확인
[스케줄 관련] 특정 Node를 drain하여 해당 노드는 SchedulingDisabled상태로 변경하고 Pod를 다른 Node로 옮기기.(맞춘 것 같은디)
[필터_데이터추출] Node 상태가 ready 갯수를 파일로 저장
<TIP>
ㄴ 이런 간단한 문제들은 에서 검색을 해봅니다.
ㄴ ready로 웹 검색을 하면 다음과 같은 방법 확인
ㄴ 응용하여 완성
[필터_데이터추출] 사용률이 가장 높은 pod를 label로 조회해서 파일로 저장
쉬운것
[Resource관련] Pod에 nodeSelector 추가
[Resource관련] deploy생성후 image 업그레이드
[네트워크] Pod(port 80)생성, NodePort 타입 Service 생성
[스케줄 관련] 특정 Deployment에 대해 replicas 수정
[필터_데이터추출] Pod에서 log grep하여 파일로 추출.
[필터_데이터추출] Taint가 없는 Node의 갯수를 파일로 저장(혹은 Taint말고 다른게 없는경우)