What is kubernetes statefulset
- #WHAT IS KUBERNETES STATEFULSET HOW TO#
- #WHAT IS KUBERNETES STATEFULSET SERIAL NUMBERS#
- #WHAT IS KUBERNETES STATEFULSET SERIAL NUMBER#
- #WHAT IS KUBERNETES STATEFULSET UPGRADE#
No persistent storage is deployed with it.Ī good example of a stateless application is going to search for something on Google. When a stateless application is deployed, it’s essentially always being deployed from scratch. You’ve already learned about stateful apps, so let’s talk about stateless apps. There are, more or less, two types of applications:
As a new one comes up, it has the same network ID and storage, which helps the application know where the data lives. New replicas won’t come up until the previous replica is up and runningĮssentially, Kubernetes keeps every Pod unique even when a Pod goes down.
When you do it, you’re interacting with a stateful application. You can reverse the above operation of scaling in to restore basic-tikv-1.Have you ever logged into an email acccout or your banking app? Sure you have! You probably do it every day. The value of Annotation is an integer array of JSON, such as.
#WHAT IS KUBERNETES STATEFULSET SERIAL NUMBER#
#WHAT IS KUBERNETES STATEFULSET SERIAL NUMBERS#
When modifying replicas and delete-slots annotation, complete the modification in the same operation otherwise, the controller operates the modification according to the general expectations. If you want to delete basic-tikv-1, set to 3 and configure the following annotations: metadata: The above configuration deploys 4 TiKV instances, namely basic-tikv-0, basic-tikv-1. With the advanced StatefulSet controller, when scaling in TidbCluster, you can not only reduce the number of replicas, but also specify the scaling in of any Pod in the PD, TiDB, or TiKV components by configuring annotations.įor example: apiVersion: /v1alpha1 You can view the AdvancedStatefulSet object in the namespace by running the following command: kubectl get -n $ asts The data format of AdvancedStatefulSet is the same as that of StatefulSet, but AdvancedStatefulSet is implemented based on CRD, with asts as the alias. View the AdvancedStatefulSet Object by kubectl
#WHAT IS KUBERNETES STATEFULSET HOW TO#
This section describes how to use the advanced StatefulSet controller. However, after the AdvancedStatefulSet feature is disabled, the AdvancedStatefulSet object cannot be automatically converted to the built-in StatefulSet object of Kubernetes. If the AdvancedStatefulSet feature is enabled, TiDB Operator converts the current StatefulSet object into an AdvancedStatefulSet object.
#WHAT IS KUBERNETES STATEFULSET UPGRADE#
For details, refer to Upgrade TiDB Operator. Enableįor Kubernetes versions = 1.16: kubectl apply -f Įnable the AdvancedStatefulSet feature in values.yaml of the TiDB Operator chart: features: This document describes how to use the advanced StatefulSet controller in TiDB Operator. It supports freely controlling the serial number of Pods. The advanced StatefulSet controller is implemented based on the built-in StatefulSet controller. If you want to delete one of the Pods in the middle to maintain its Node but no other Nodes can be migrated, or if you want to delete a Pod that fails and to create another Pod with a different serial number, you cannot implement such desired function by the built-in StatefulSet. When you use local storage, Pods are associated with the Nodes storage resources and cannot be scheduled freely. When you scale in to two replicas, pod-2 is deleted. For example, when you scale out to four replicas, pod-3 is added. When scaling out or scaling in, you must add a Pod at the end or delete the last pod. For example, when there are three replicas, the Pods are named as pod-0, pod-1, and pod-2. Kubernetes has a built-in StatefulSet that allocates consecutive serial numbers to Pods.