kubectl config current-context
kubectl config get-contexts
kubectl get nodes
kubectl get pods -n <NAMESPACE>
kubectl get events -n <NAMESPACE> --sort-by=.metadata.creationTimestamp
kubectl describe pod <POD> -n <NAMESPACE>
kubectl logs <POD> -n <NAMESPACE> --tail=100
kubectl logs <POD> -n <NAMESPACE> --previous --tail=100
Use StatefulSets for workloads requiring stable Pod identities and persistent storage. Design the Headless Service, volumeClaimTemplates, StorageClass, and recovery procedures together. StatefulSet does not automatically provide database replication or backups.
Check PVC deletion policies and PV reclaim policies before planning deletions.
Document probes, resource requests and limits, PDBs, deployment strategies, logs, metrics, and backup recovery for each workload. Review API, add-on, node, and storage-driver compatibility together when upgrading EKS.
The AI block below is preserved because the connected tool cannot read its contents.
StatefulSet은 쿠버네티스(Kubernetes)에서 상태를 유지해야 하는 애플리케이션을 관리하기 위한 워크로드 API 객체입니다.
| 특성 | StatefulSet | Deployment |
|---|---|---|
| Pod 식별자 | 고유하고 영구적 (pod-0, pod-1) | 임의 생성 |
| 영구 스토리지 | PVC 템플릿 지원 | 별도 구성 필요 |
| 배포 순서 | 순차적 | 병렬 |
| 스케일링 | 순차적 | 병렬 |
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
selector:
matchLabels:
app: nginx
serviceName: "nginx"
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
name: web
volumeMounts:
- name: www
mountPath: /usr/share/nginx/html
volumeClaimTemplates:
- metadata:
name: www
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
스토리지를 사용하는 경우 PersistentVolume Provisioner 구성 필요
삭제 시 PVC는 자동으로 삭제되지 않음 (데이터 보호)
Pod 이름과 호스트 이름을 동일하게 만들기 위해 Headless Service 필요