본문 바로가기
  • 오늘처럼

Kubernetes33

[Kubernetes] 1-13. 파드 내부 컨테이너 간의 볼륨 공유 이번에는 하나의 파드 안에 있는 여러개의 컨테이너들이 서로 볼륨(데이터) 공간을 공유하는 실습을 수행한다. 상세 조건은 다음과 같다. Name : test-multi-container Namespace : test-namespace 파드 내부 개별 Container 별 조건 Container 1 Name : c1 image : nginx:1.19.3 수행 : 구동 시 파드 내 환경 변수 MY_NODE_NAME 에 파드가 구동되는 노드 이름을 저장 Container 2 Name : c2 image : busybox:1.3 수행 : 매 1초마다 date 명령의 결과를 /공유볼륨경로/date.log 에 쓰기 수행 Container 3 Name : c3 image : busybox:1.3 수행 : tail 명령.. 2022. 5. 6.
[Kubernetes] 1-11. Daemonset 구동해보기 다음의 조건을 만족하는 daemonset을 클러스터에 배포해본다. Namespace : test-namespace Name : test-ds Labels : hello=world UUID : 423f6a0b-9dj3-kjd8-fj39-e09dc078f862 Resource quota Request CPU : 10 Millicore Memory : 10 Mib Master / Worker 노드 모두 구동 하단과 같이 daemonset yaml 파일을 준비한다. (별도의 샘플이 없을 경우 'kubectl create deployment' 명령어를 사용하여 deployment yaml 파일을 획득한 후에 양식을 변경하는 방법도 가능하다.) apiVersion: apps/v1 kind: DaemonSet met.. 2022. 5. 3.
[Kubernetes] 1-10. RBAC 적용해보기 이번에는 새로운 ServiceAccount(이하 SA)과 Role을 만들고 RoleBinding을 통하여 매핑하여 해당 SA 가 제한된 기능만을 수행할 수 있는지를 확인한다. 먼저 Service Account를 생성한다. kubectl -n test-namespace create sa test-sa serviceaccount/test-sa created 이후에 secret 과 configmap 을 생성만 할 수 있는 Role을 생성한다. kubectl -n test-registry create role test-role \ --verb=create \ --resource=secret \ --resource=configmap 위 kubectl create 명령어와 동일하게 하단의 yaml 파일을 apply.. 2022. 5. 3.
[Kubernetes] 1-09. Scheduler 역할 확인하기 클러스터의 노드를 확인한 후에 구동되어 있는 스케쥴러를 삭제한다. ### 클러스터 구성 확인 root@localhost:~# kubectl get node NAME STATUS ROLES AGE VERSION master Ready master 26h v1.23.1 worker Ready 26h v1.23.1 ### 마스터 노드 접속 하여 스케쥴러 파드 확인 ssh master root@localhost:~# kubectl -n kube-system get pod | grep schedule kube-scheduler-master 1/1 Running 0 6s ### 스케쥴러 파드의 static pod manifest를 이동하여 파드를 제거 처리 root@localhost:~# cd /etc/kubern.. 2022. 5. 3.
[Kubernetes] 1-08. 마스터 노드 정보 확인하기 이번에는 마스터 컴포넌트의 구성요소인 kubelet, kube-apiserver, kube-scheduler, kube-controller-manager, entcd 에 대한 정보를 확인해본다. 먼저 마스터노드에 접속하여 프로세스로 kubelet이 구동되어 있는지 확인한다. ### 프로세스 확인 ssh root@localhost:~# ps -ef | grep kubelet ### systemd 확인 root@localhost:~# find /etc/systemd/system/ | grep kube /etc/systemd/system/kubelet.service.d /etc/systemd/system/kubelet.service.d/10-kubeadm.conf /etc/systemd/system/multi.. 2022. 5. 3.
[Kubernetes] 1-07. Node, Pod 리소스 사용량 확인 metrics-server 쿠버네티스 클러스터 내에 설치되어 있는 경우 kubectl top 명령어를 사용하여 노드와 파드의 자원 사용량을 확인할 수 있다. 노드의 자원 사용량 확인 명령어는 다음과 같다. ### 노드 자원 사용량 확인 kubectl top node 파드의 자원 사용량 확인 명령어는 다음과 같다. ### 파드 자원 사용량 확인 kubectl top pod ### 파드 자원 사용량 확인 (컨테이너 포함) kubectl top pod --containers=true 만약 metric-server 가 아직 설치되어 있지 않거나, 정상 동작하지 않을 경우 하단의 에러메세지가 표시된다. kubectl top node error: Metrics API not available 2022. 5. 3.