Kubernetes

[Kubernetes] ETCD For Beginners

thdwldud 2026. 5. 18. 11:10
728x90
반응형

해당 내용은 Udemy의 Certified Kubernetes Administrator(CKA) with Practice Tests 강의를 공부한 내용입니다.

 

Certified Kubernetes Administrator (CKA) with Practice Tests

<p><strong>CKA Certification Course – Certified Kubernetes Administrator</strong></p><p>Kubernetes is one of the highest trending technology in Cloud Computing as of today. Kubernetes had the fastest growth in job searches, over 173% from a year before,

www.udemy.com

 

ETCD 입문

etcd는 분산형, 고신뢰성 Key-Value 저장소로, 단순하면서도 빠른 성능을 제공

 

Key-Value Store란?

기존의 관계형 데이터베이스(SQL)는 데이터를 다음과 같이 저장 :

  • 행(Row): 하나의 데이터 (예: 사람 1명)
  • 열(Column): 속성 (이름, 나이 등)

예를 들어, 사람 정보를 저장하는 테이블이 있다고 하면:

  • 직장인은 급여 컬럼 필요
  • 학생은 성적 컬럼 필요

→ 이 경우 모든 데이터를 위해 테이블 구조를 계속 확장해야 함

 

Key-Value 방식

Key-Value 저장소는 데이터를 문서 단위(JSON/YAML)로 저장

각 데이터는 독립적으로 구조를 가질 수 있음:

  • 직장인 → salary 포함
  • 학생 → grade 포함

예시 (JSON) :

{
  "name": "John Doe",
  "age": 45,
  "location": "New York",
  "salary": 5000
}
{
  "name": "Aryan Kumar",
  "age": 10,
  "location": "New York",
  "Grade": "A"
}

→ 즉 스키마가 고정되지 않고 유연하게 데이터 저장 가능

 

etcd 설치 및 시작

  1. GitHub에서 바이너리 다운로드
  2. 압축 해제
  3. 실행

기본적으로 etcd는 2379 포트에서 동작

다운로드 예시:

curl -L https://github.com/etcd-io/etcd/releases/download/v3.3.11/etcd-v3.3.11-linux-amd64.tar.gz -o etcd-v3.3.11-linux-amd64.tar.gz

 

etcdctl 사용법 (API v2 기준)

키 저장 : 

./etcdctl set key1 value1

 

키 조회 :

./etcdctl get key1

 

명령어 목록 확인 :

./etcdctl

NAME:
etcdctl - A simple command line client for etcd.

COMMANDS:
  backup          backup an etcd directory
  cluster-health  check the health of the etcd cluster
  mk              make a new key with a given value
  mkdir           make a new directory
  rm              remove a key or a directory
  rmdir           removes the key if it is an empty directory or a key-value pair
  get             retrieve the value of a key

 

 

API v2 → v3 변화

etcdctl은 API 버전에 따라 명령어가 다름

버전 확인:

./etcdctl --version

etcdctl version: 3.3.11
API version: 2

 

API v3로 변경 방법

방법 1:

ETCDCTL_API=3 ./etcdctl version

 

방법 2:

exportETCDCTL_API=3
./etcdctl version

 

API v3 주요 변경점

  • setput
  • get : 동일
  • version : 옵션이 아닌 서브 커맨드

API v3 사용 예시

exportETCDCTL_API=3

./etcdctl put key1 value1

 

출력 : 

OK

 

조회 :

./etcdctlget key1

 

출력 :

key1
value1
728x90
반응형

'Kubernetes' 카테고리의 다른 글

[Kubernetes] Kube Controller Manager  (0) 2026.06.08
[Kubernetes] Kube-API Server  (0) 2026.06.01
[Kubernetes] ETCD in Kubernetes  (0) 2026.05.25
[Kubernetes] Docker vs ContainerD  (0) 2026.05.09
[Kubernetes] Cluster Architecture  (0) 2026.05.03