Kubernetes 소개
Frank Heilmann
Platform Architect and Freelance Instructor
상태 저장 앱:
중단/종료되어도, 새 복제본(Pod)이 저장된 상태를 읽어 그 지점부터 계속 동작 가능
apiVersion, kind, metadata, spec, templatereplicas는 StatefulSet의 Pod 수를 정의selector는 뒤에서 설명apiVersion: apps/v1
kind: StatefulSet
metadata:
name: <deployment name>
labels:
app: <a label for the application>
spec:
replicas: <number of initial replicas>
selector:
matchLabels:
app: <matches the label above>
template:
metadata:
labels:
app: <label to be given to each pod>
spec:
containers:
- name: <container name>
image: <the image to be used>
ports:
- containerPort: <ports for networking>
StatefulSet 배포는 Deployment와 유사:
kubectl apply -f <manifest.yml>Deployment와 다름:pod-0, pod-1, pod-2처럼 예측 가능한 이름을 가짐StatefulSet Pod는 앱에서 다른 역할 수행 가능replicas 값을 수정 후 재적용kubectl scale statefulsets ... 사용pod-0, pod-1, pod-2, 그다음 pod-3,
그리고 pod-4가 추가됨pod-4, 그다음 pod-3kubectl을 사용kubectl get pods는 StatefulSet의 모든 Pod와
현재 상태를 반환kubectl get services는 StatefulSet이 사용할 수 있는
모든 Service를 반환Kubernetes 소개