StatefulSet は、スケジュールされた場所にかかわらず GKE が保持する一意で永続的な ID と固有のホスト名を持つ「ポッド」のセットを表します。任意の StatefulSet Pod の状態情報やその他の復元データは、StatefulSet の各 Pod に関連付けられた永続ディスク ストレージに保持されます。StatefulSet Pod はいつでも再起動できます。
Pod のレプリカには一意の序数インデックスがあり、レプリカごとのボリュームとネットワーク ID(ホスト名)をサポートしていますが、GKE が再スケジュールする、または Pod を強制排除すると、レプリカに割り当てられる IP アドレスが変わる可能性があります。
ネットワークの問題を軽減するために、このアーキテクチャでは Kubernetes Service リソースを使用する必要があります。詳細については、Kubernetes Service のタイプをご覧ください。
Headless Services
初期化時に、StatefulSet が一致する Headless Service とペアになります。
Service の「metadata.name」が StatefulSet の serviceName フィールドと一致することを確認します。これにより、アプリケーション内の各 Pod を、明確に定義された一意のネットワーク アドレスにアドレスを指定できます。また、Headless Service は、StatefulSet の各レプリカにマルチ IP レコードを提供するため、完全なピア検出が可能になります。
[[["わかりやすい","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-07-10 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)"]]