본문 바로가기

cloud/k8s(문제풀이)76

[따배쿠CKA]8.NodeSelector *NodeSelector 특정 앱 파드를 특정 노드에서 실행시켜달라고 요청하는 것을 의미한다. Q. 작업 클러스터: kubectl config use-context k8s Scheule a pod as follows: - Name: eshop-store - Image: nginx - Node Selector: disktype=ssd : disktype이 ssd 로 표시 되어 있는 pod 를 실행시켜라 1. 노드 레이블 확인하기 kubectl get nodes --show-labels kubectl get nodes -L disktype 2. pods 만들기 (Assign pods to Nodes) k run eshop-store --image=nginx --dry-run=client -o yaml > e.. 2022. 8. 9.
[따배쿠CKA]7. Rolling Update & Roll Back Q. 작업 클러스터: kubectl config use-context k8s create a deployment as follows: TASK: - name: nginx-app - using container nginx with version 1.11.10-alpine - The deployment should contain 3 replicas Next, deploy the application with new Version 1.11.13-alpine, by performing a rolling update Finally, rollback that update to the previous version 1.11.10-alpine 1. 작업 클러스터 변경 (deployment) k config use-co.. 2022. 8. 8.
[따배쿠CKA]6. Deployment & Pod Scale * 작업 클러스터 설정 kubectl config use-context kubernetes-admin@kubernetes * 사전 작업 k get ns k create ns devops Q. Pod Scale out 작업 클러스터: k8s Expand the number of running Pods in "eshop-order" to 5 - namespace: devops - deployment: eshop-order 1. 문제에 맞는 상황을 조회 : namespace 가 있는지, deployment 가 배포가 되어 있는지 확인 k get ns devops k get deployments -n devops k get deployments -n devops 2. rs 늘리기 * 샘플과 사전 조건이 달라 현.. 2022. 8. 8.
[따배쿠CKA]5.Side-car Container Pod 실행하기 * Side-car Container Pod 란? 예를들어 A 라는 nginx 컨테이너가 있으면 이 컨테이너는 log 가 남겨진다(/var/log/html) 별도의 쿠버네티스 볼륨을 만든다(varlog 라는) 이볼륨을 A 컨테이너에 mount 를 한다.(read,write 가능, 데이터 저장한다 varlog 에) -> 이전 /var/log/html 에 쌓이는 로그가 varlog에 쌓이게 된다.(accss.log, error.log) 클라이언트가 varlog 의 데이터를 가공해서 사용하고 싶을때는 어떻게 할까? B라는 컨테이너를 만들어 데이터가 쌓이는 경로를 (/data/) varlog 로 마운트 해주는 방식이다. A는 varlog 에 로그를 기록하고 B 컨테이너에서는 varlog 에 기록된 데이터를 갖고.. 2022. 8. 8.
[따배쿠CKA]4.Multi-container Pod 생성하기 create pod - 작업 클러스터 : hk8s create a pod named lab004 with 3 containers running: nginx, redis, memcached - kubectl 명령어로는 Multi pod 를 생성할 수 없다 . 1. 단일 파드 생성하기 k run lab004 --image=nginx --dry-run=client -o yaml > lab004.yaml : 상단의 그림과 같이 pod가 생성된다. 2. 생성한 파드 수정하기 : 필요없는 부분은 삭제하고 필요한 부분을 추가한다. 3. 실행하기 k apply -f lab004 k get pods 4. 확인하기 k describe pods lab004 * 본 게시글은 "TTABAE-LEARN" 을 보고 정리한 내용입니다. 2022. 8. 8.
[따배쿠CKA-3]Static-Pod 생성하기 1. kubectl 구동방식 * 전제조건: master Node 1개, node1, node2 1) "kubectl nginx pod" 라는 명령어를 사용자가 입력하면 2) master Node 의 API 로 전달, API 가 전달을 받으면, 3) master Node 의 ETCD 안에 있는 클러스터를 꺼내서 scheduler에게 보내서 요청을한다. 4) Scheduler 은 "kubectl nginx pod" 명령어에 Node1, Node2 중에 어디가 더 적합한지 확인을 함 5) Scheulder은 노드와 클러스터의 상태를 확인하고 가장 적합한 Node를 찾아 API 에게 알려준다. 예를들면 적합한 Node 가 1번 Node 이면 6) API가 1번 Node 의 kubelet 에게 요청을 한다. "k.. 2022. 8. 3.