官术网_书友最值得收藏!

StatefulSets

Deployments are usually used to deploy stateless components of your application. For stateful components, Kubernetes provides another API Object named StatefulSet. The principle of this operation is very similar to Deployment it manages ReplicaSets and Pods in a declarative way and provides smooth rollouts and rollbacks. However, there are some key differences:

  • StatefulSets ensure a deterministic (sticky) ID of Pods, which consists of <statefulSetName>-<ordinal>. For Deployments, you would have a random ID consisting of <deploymentName>-<randomHash>.
  • For StatefulSets, the Pods are started and terminated in a specific, predictable order while scaling the ReplicaSet.
  • In terms of storage, Kubernetes creates PersistentVolumeClaims based on volumeClaimTemplates of the StatefulSet Object for each Pod in the StatefulSet and always attaches this to the Pod with the same ID. For Deployments, if you choose to use volumeClaimTemplates, Kubernetes will create a single PersistentVolumeClaim and attach the same to all the Pods in the Deployment.
  • You need to create a headless Service Object that is responsible for managing the deterministic network identity (DNS names) for Pods. The Headless Service allows us to return all Pod IPs behind the Service as DNS A records instead of a single DNS A record with a Service Cluster IP.

StatefulSets use a similar Spec to Deployments you can find out more regarding StatefulSets by looking at the official documentation: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/.

主站蜘蛛池模板: 五家渠市| 集安市| 开远市| 榆林市| 辉南县| 内乡县| 仁怀市| 弥渡县| 如东县| 松江区| 永城市| 太仓市| 鹤庆县| 台东县| 襄城县| 南陵县| 文安县| 大新县| 肇州县| 阿拉善盟| 兰溪市| 灵丘县| 保德县| 筠连县| 江源县| 义乌市| 修武县| 甘泉县| 平定县| 沁阳市| 长阳| 随州市| 无棣县| 郸城县| 桂阳县| 岳普湖县| 宾阳县| 扶余县| 都安| 油尖旺区| 鄂托克前旗|