Kubernetes

From HPCWIKI
Revision as of 13:11, 17 July 2026 by Clara (talk | contribs) (Phase 0.2: Create Kubernetes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Kubernetes

Template:Status

Template:TOC

Overview

Kubernetes(K8s)는 Google에서 오픈소스로 공개한 컨테이너 오케스트레이션 플랫폼. Docker 컨테이너의 배포, 스케일링, 관리를 자동화. 클라우드 네이티브 생태계의 핵심 인프라.

Summary

  • * 무엇인가? 컨테이너 오케스트레이션 플랫폼. Pod, Service, Deployment 관리
  • * 왜 필요한가? 수백/수천 컨테이너 자동 관리. GPU 컨테이너도 지원
  • * 언제 사용하는가? 멀티 컨테이너 앱, 마이크로서비스, GPU 워크로드

---

Purpose

이 문서가 존재하는 이유

  • Goal: Kubernetes의 개념, 사용법, 설정 가이드 제공
  • Scope: 기본 개념, 설치/설정, 사용 예제, 모범 사례
  • Non-goals: 고급 커스터마이징, 내부 소스 코드 분석

---

Key Concepts

Template:KeyConcepts

---

Architecture

K8s는 Control Plane(API Server, etcd, Scheduler, Controller Manager)와 Worker Node(Kubelet, Kube-proxy, Container Runtime)로 구성. GPU 워크로드를 위해 NVIDIA Device Plugin 필요.

---

Workflow

1. 1. K8s 클러스터 구축(minikube/kubeadm/EKS/GKE)

2. 2. Docker 이미지 빌드 + 레지스트리 푸시

3. 3. Deployment YAML 작성 (replicas, resource limits)

4. 4. kubectl apply -f deployment.yaml

5. 5. Service로 외부 접근 설정

6. 6. HPA(Horizontal Pod Autoscaler)로 자동 스케일링

7. 7. GPU 워크로드: NVIDIA Device Plugin 설치

---

Configuration

# deployment.yaml - GPU 컨테이너 배포 예시
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gpu-app
spec:
  replicas: 2
  selector:
    matchLabels:
      app: gpu-app
  template:
    metadata:
      labels:
        app: gpu-app
    spec:
      containers:
      - name: gpu-container
        image: nvidia/cuda:12.2-base
        resources:
          limits:
            nvidia.com/gpu: 1  # GPU 1개 할당
          requests:
            nvidia.com/gpu: 1
        command: ["nvidia-smi"]
---
# Service - 외부 접근
apiVersion: v1
kind: Service
metadata:
  name: gpu-app-service
spec:
  selector:
    app: gpu-app
  ports:
  - port: 80
    targetPort: 8080
  type: LoadBalancer

---

Best Practices

  • GPU 사용 시 NVIDIA Device Plugin 필수 설치
  • resource requests/limits로 리소스 격리
  • liveness/readiness probe로 건강 상태 모니터링
  • ConfigMap/Secret으로 설정/시크릿 분리
  • Helm로 패키지 관리, Kustomize로 환경별 설정
  • GPU 스케줄링: nvidia.com/gpu 리소스 요청

---

Limitations

  • 설정 복잡도 높음 (초보자에게 진입장벽)
  • GPU 컨테이너는 NVIDIA 드라이버 + Device Plugin 필요
  • Stateful 워크로드(PVC)는 스토리지 클래스 고려 필요

---

References

---

Related Pages