0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ubuntu で Kubernetes 三昧その 8(Statefulset)

Posted at

Ubuntu で Kubernetes 三昧その7(Deamonset)のつづきです。

StatefulSetが作成するPodの名前は、-<0から始まる順序インデックス> という形式で、常に固定です。

例: replicas: 3 の mysql というStatefulSetを作成した場合
    mysql-0
    mysql-1
    mysql-2

このPod mysql-0 が何らかの理由で停止・削除されても、Kubernetesは必ず同じ mysql-0 という名前でPodを再作成します。 この予測可能で不変な名前が、IDの基本となります。

@masternode1:~/kubernetes-examples$ kubectl apply -f statefulset/nginx.yaml 
statefulset.apps/nginx-deployment created

@masternode1:~/kubernetes-examples$ kubectl get statefulset
NAME               READY   AGE
nginx-deployment   2/2     53s

@masternode1:~/kubernetes-examples$ kubectl get pods
NAME                     READY   STATUS    RESTARTS      AGE
nginx-deployment-0       1/1     Running   0             58s
nginx-deployment-1       1/1     Running   0             54s

この、-0, -1 となっているのが、statefulset であることを示しています。

つづく。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?