pod controller statefulset controller

A, statefulset Profile

Second, why have headless? ?
Third, why have volumeClainTemplate? ?
Four, statefulSet demo
(1) View statefulset definition
(2) Inventory definition StatefulSet
(3) delete the pre-operation
(4) modify the size of pv of 2Gi to
(5) create statefulset
five rollover, extension telescopic, version upgrade, modify the update strategy
1, rollover
2, the telescopic extension
3, update policies and version upgrades


    To solve this problem, on the introduction of state information StatefulSet reserved for the Pod.
    StatefulSet to solve the problem stateful services (corresponding to Deployments and ReplicaSets is stateless service design), which application scenarios comprising:
a stable persistent storage, i.e., the Pod rescheduling or access to the same persistent data based PVC to achieve
2, stable network sign that the Pod reschedule its PodName and HostName unchanged, based on Headless Service (ie no Cluster IP of Service) to achieve
3, ordered the deployment, expansion and orderly, that is Pod sequential, when deployed or extended according to the order defined sequentially sequentially (i.e. before the next Pod run from 0 to N-1 are all necessary before Pod and Ready running state), based on the init containers implemented
4, orderly contraction order to remove (i.e., from N-1 to 0)
5, rollover ordered
from the above scenarios can be found, StatefulSet consists of the following components:

Headless Service (headless Service) is used to generate a resolvable identifier DNS resource records Pod.
volumeClaimTemplates (template storage volume application) based on a static or dynamic manner to provide PV is supplied as a proprietary fixed Pod storage resources.
StatefulSet, Pod for resource control.


Second, why have headless? ?
    In deployment, each pod is not the name, is a random string, is disordered. The statefulset requirement is ordered, the name of each pod must be fixed. When the node linked to the identifier after the reconstruction is constant, each node of the node name can not be changed. pod pod name is identified as a unique identifier, which must ensure a stable and unique identifier.
    In order to achieve a stable identifier, this time you need to resolve a headless service straight to reach pod, pod also need to configure a unique name.


Third, why have volumeClainTemplate? ?
    Most states have a replica set will be used in persistent storage, such as a distributed system, since the data is not the same, each node needs its own dedicated storage node. The storage volumes created in the pod deployment template is a shared storage volume, multiple pod use the same storage volume, while statefulset definition of each pod can not use the same storage volume, thereby creating a pod pod-based template It is inappropriate, which requires the introduction of volumeClainTemplate, used when creating the pod statefulset, will automatically generate a PVC, requesting a binding PV, thus have their own dedicated storage volume. Pod name, PVC PV diagram, and

Four, statefulSet demo
stuff before creating StatefulSet need to be prepared, it is worth noting that the order of creation is critical, create the following order:
1, Volume
2, Persistent Volume
3, Persistent Volume the Claim
4, Service
5, StatefulSet
Volume can have a variety type, such as nfs, glusterfs, etc., we use here to create the ceph RBD

 


Fifth, rollover, telescopic extension, upgrade, modify, update policies
1, rollover
RollingUpdate update policy implementation Pod in StatefulSet automatic rollover. When StatefulSet of .spec.updateStrategy.type set RollingUpdate, the default is: RollingUpdate. StatefulSet StatefulSet controller will be deleted and re-create each Pod. Pod same order will be terminated (from the largest to the smallest sequence number ordinal), update each Pod. Before updating its predecessor, it will wait for the state to being updated Pod is running and ready. Following the rolling operation is sequentially updated to update 2-0.

 

Guess you like

Origin www.cnblogs.com/muzinan110/p/11110867.html