본문 바로가기

kubernetes68

[k8s] Kubernetes AutoScaling Kubernetes AutoScaling 1. Cluster level scalability 기존의 worker node의 resource가 부족할 경우 worker node를 자동으로 확장 GCP, AWS 및 Azure와 같은 cloud infrastructure를 통해서 사용 OpenStack의 Auto Scaling Kubernetes cluster Cluster Autoscaler (CA) Pod가 node 리소스를 할당 받지 못해 pending 될 때 worker node를 확장 Node pool의 min/max를 기준으로 그 범위 내로 node 확장 할당된 node가 장시간 충분히 활용되지 못하면 node를 해제 10초마다 불필요한 node 확인, 10분간 적은 리소스 유지하면 scale do.. 2023. 5. 2.
[k8s] kube-proxy kube-proxy default mode는 iptables API로 service를 생성하면 그 service의 목적지에 따른 endpoint(진입점)을 iptables rule로 만들어 달라고 kernel에게 요청함 worker node마다 1개씩 존재 nodeport를 생성하면 iptables의 rule를 통해서 외부로 서비스 될 수 있게 port listen 3가지 mode : user space mode iptables mode IPVS mode [hands - on] K8s service 동작 vi deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: web spec: replicas: 3 selector: matchLabe.. 2023. 4. 10.
[k8s] Persistent Volume & Persistent Volume Claim PV(Persistent Volume) K8s cluster 외부 storage와 연결을 담당하는 리소스 https://kubernetes.io/docs/concepts/storage/persistent-volumes/ 참고 PVC(Persistent Volume Claim) PV와 pod를 연결하기 위한 리소스 https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims 참고 ❗ 역할을 나눈다면, 스토리지 지식이 있는 쿠버네티스 클러스터 관리자 또는 스토리지 관리자는 PV 리소스를 생성해 스토리지와 연결해 두고, 파드 개발자는 PVC를 생성해 자신의 파드 및 관리자가 제공해 준 PV와 연결해 파드에서 볼륨을 .. 2023. 4. 3.
[k8s] Storage emptyDir 및 share volume emptyDir volume 빈 디렉토리로 시작 Pod 내부에서 실행중인 application은 필요한 모든 파일 작성 Pod를 삭제하면 volume의 내용은 손실 동일한 pod에서 실행되는 컨테이너 간에 파일을 공유할 때 유용 https://kubernetes.io/docs/concepts/storage/volumes/#emptydir참고 [Hands - on] pod 생성 및 확인 vi empty.yaml apiVersion: v1 kind: Pod metadata: name: web-empty spec: containers: - image: nginx:1.14 name: nginx volumeMounts: - name: html mountPath: /usr/share/nginx/html volume.. 2023. 3. 20.
[k8s] 인증과 권한 관리 - 권한편 권한관리 특정 유저나 ServiceAccount가 접근하려는 API에 접근 권한을 설정 권한 있는 User만 접근하도록 허용 권한제어 Role 어떤 API를 이용할 수 있는지의 정의 K8s의 사용권한을 정의 지정된 namespace에서만 유효 verbs : create : 새로운 리소스 생성 get : 개별 리소스 조회 list : 여러 건의 리소스 조회 update : 기존 리소스 내용 전체 업데이트 patch : 기존 리소스 중 일부 내용 변경 delete : 개별 리소스 삭제 deletecollection : 여러 리소스 삭제 RoleBinding User/Group 또는 ServiceAccount와 Role을 연결 .. 2023. 3. 6.
[K8s] Cordon& Drain Cordon& Drain이란? Cordon node scheduling 중단(cordon)및 허용(uncordon) 특정 node에 pod 스케줄을 금지하거나 해제 kubectl [cordon|uncordon] NODE [options] [ Hands - on ] node2의 scheduling 중단 및 확인 kubectl cordon node2.example.com kubectl get nodes NAME STATUS ROLES AGE VERSION master.example.com Ready control-plane 22h v1.24.1 node1.example.com Ready 22h v1.24.1 node2.example.com Ready,SchedulingDisabled 22h v1.24.1 p.. 2023. 2. 20.
[k8s] Pod Scheduling Node selector란? Worker node에 할당된 label을 이용해 node를 선택 node label 설정 kubectl label nodes = kubectl label node1.example.com gpu=true kubectl get nodes -L definition apiVersion: v1 kind: Pod metadata: name: tensorflow-gpu spec: containers: - name: tensorflow image: tensorflow/tensorflow:nightly-jupyter ports: - containerPort: 8888 protocol: TCP nodeSelector: gpu: "true" [ Hands - on ] node2에 gpu=tru.. 2023. 2. 6.
[k8s] Secret Secret이란? Container가 사용하는 password, auth token, ssh key와 같은 중요한 정보를 저장 민감한 구성 정보를 base64로 인코딩해서 한 곳에 모아서 관리 Secret 데이터 전달 방법 Command-line Argument Environment Variable Volume Mount Available command에 따라 들어가는 옵션이 달라짐 docker-registry : create a secret for use with a Docker registry generic : create a secret from a local file, directory or literal value tls : create a TLS secret type Opaque : 임의의 사.. 2023. 1. 25.