이 페이지에서는 Google Kubernetes Engine(GKE)에서 StatefulSet 객체를 사용하는 방법을 설명합니다. 또한 스테이트풀(Stateful) 애플리케이션 배포에 대해서도 설명합니다.
StatefulSet 정보
StatefulSet는 예약된 위치와 관계없이 GKE가 유지보수하는 고유한 영구 ID 및 안정적인 호스트 이름이 포함된 일련의 포드를 나타냅니다. 모든 특정 StatefulSet 포드의 상태 정보 및 기타 복원력이 우수한 데이터는 StatefulSet의 각 포드와 연결된 영구 볼륨에서 유지관리됩니다. StatefulSet 포드는 언제든지 다시 시작할 수 있습니다.
StatefulSet는 GKE 및 Kubernetes에서 유사하게 작동합니다. 이 문서에서는 GKE 관련 고려사항을 설명합니다. StatefulSet의 작동 방식을 알아보려면 StatefulSet에 대한 Kubernetes 문서를 참조하세요.
StatefulSet의 네트워킹 계획
StatefulSet는 PersistentVolume 및 고유한 네트워크 ID(호스트 이름) 형식으로 영구 스토리지를 제공합니다. 다음 표에서는 애플리케이션 운영자가 StatefulSet를 구성할 때 알아야 할 주의사항을 포함되어 있습니다.
네트워킹 주의사항
설명
권장사항
고정 IP 주소 대신 GKE 서비스
포드 복제본에는 고유한 서수 색인이 있고, 복제본당 볼륨과 네트워크 ID(호스트 이름)가 지원되지만, GKE가 포드를 다시 예약하거나 삭제하면 복제본에 할당된 IP 주소가 변경될 수 있습니다.
네트워킹 문제를 완화하려면 아키텍처에서 Kubernetes 서비스 리소스를 사용해야 합니다. 자세한 내용은 Kubernetes 서비스 유형을 참고하세요.
헤드리스 서비스
초기화되면 StatefulSet는 일치하는 헤드리스 서비스와 페어링됩니다.
서비스의 `metadata.name`이 StatefulSet의 serviceName 필드와 일치하는지 확인하세요. 이렇게 하면 애플리케이션의 각 포드를 고유하고 잘 정의된 네트워크 주소로 처리할 수 있습니다. 또한 헤드리스 서비스는 StatefulSet의 각 복제본에 대해 다중 IP 레코드를 제공하므로 전체 피어 검색이 가능합니다.
피어 검색
스테이트풀(Stateful) 애플리케이션이 완전한 가용성으로 기능하려면 최소 복제본 수(쿼럼)가 필요합니다.
포드가 비정상 종료되거나 다시 예약되거나 삭제될 수 있으므로 StatefulSet의 각 복제본은 쿼럼을 종료하고 다시 조인할 수 있어야 합니다. 피어링이 필요한 애플리케이션은 Kubernetes의 헤드리스 서비스를 통해 다른 피어를 검색할 수 있어야 합니다.
준비 프로브 및 활성 프로브를 기반으로 하는 상태 점검
해당하는 경우 애플리케이션이 준비, 활성, 시작 프로브를 적절하게 구성해야 합니다.
각 프로브의 제한 시간을 선택하는 것은 애플리케이션의 요구사항에 따라 다릅니다.
준비 프로브의 경우 다음 권장사항에 따라 트래픽을 처리할 준비가 되면 애플리케이션을 준비 상태로 표시합니다.
활성 프로브: 활성 프로브를 사용하여 컨테이너가 정상인지 여부를 알릴 수 있습니다. 예를 들어 데이터베이스 복제본은 활성 프로브를 사용하여 교착 상태 등에서 GKE가 복제본을 다시 시작해야 함을 나타낼 수 있습니다.
준비 프로브: 준비 프로브를 사용하여 복제본이 트래픽 처리를 일시적으로 사용하지 못하도록 삭제할 수 있습니다. 예를 들어 백업을 수행해야 하는 데이터베이스 복제본이 있는 경우 준비 프로브를 사용하여 요청 수신을 일시적으로 중지할 수 있습니다.
시작 프로브: 장기 실행 초기화가 완료될 때까지 시작 프로브를 사용하여 상태 점검을 지연시킬 수 있습니다. 예를 들어 데이터베이스 복제본이 있는 경우 시작 프로브를 사용하여 디스크에서 저장된 데이터의 초기화를 기다릴 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-01(UTC)"],[],[],null,["# About StatefulSets in GKE\n\n[Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview) [Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThis page describes the use of *StatefulSet* objects in\nGoogle Kubernetes Engine (GKE). You can also learn how to\n[Deploy a stateful application](/kubernetes-engine/docs/how-to/stateful-apps).\n\nAbout StatefulSets\n------------------\n\nStatefulSets represent a set of Pods with unique, persistent identities, and\nstable hostnames that GKE maintains regardless of where they are\nscheduled. The state information and other resilient data for any given\nStatefulSet Pod is maintained in [persistent\nvolumes](/kubernetes-engine/docs/concepts/persistent-volumes) associated with\neach Pod in the StatefulSet. StatefulSet Pods can be restarted at any time.\n\nFor [stateless applications](/kubernetes-engine/docs/how-to/deploying-workloads-overview#stateless_applications), use\n[Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/).\n\nStatefulSets function similarly in GKE and in Kubernetes. This\ndocument describes any GKE-specific considerations. To learn\nhow StatefulSets work, see the\n[Kubernetes documentation about StatefulSets](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/).\n\n### Plan networking for StatefulSets\n\nStatefulSets provide persistent storage in the form of a PersistentVolume and a\nunique network identity (hostname). The following table includes the caveats that\napplication operators should be aware of when configuring a StatefulSet:\n\nTo read more about probes, see [Configure Liveness, Readiness, and Startup Probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes).\n\n\nWork with StatefulSets\n----------------------\n\nTo learn how to deploy StatefulSets in your GKE cluster and\ninteract with them, see the Kubernetes documentation about\n[StatefulSet basics](https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/).\n\nWhat's next\n-----------\n\n- [Learn how to deploy a stateful application](/kubernetes-engine/docs/how-to/stateful-apps)\n- [Learn how to update StatefulSets using rolling updates](https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#rolling-update)\n- [Learn more about deploying workloads in GKE](/kubernetes-engine/docs/how-to/deploying-workloads-overview)\n- [Read more about StatefulSets in the Kubernetes documentation](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/)\n- [Take a tutorial about upgrading a cluster running a stateful workload](/kubernetes-engine/docs/tutorials/upgrading-stateful-workload)"]]