Skip to content

Commit bf6c784

Browse files
committed
add a new blog for etcd learner mode usage in kubeadm join
1 parent 1e398be commit bf6c784

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
layout: blog
3+
title: 'kubeadm: Use etcd Learner to Join a Control Plane Node Safely'
4+
date: 2023-09-25
5+
slug: kubeadm-use-etcd-learner-mode
6+
---
7+
8+
**Author:** Paco Xu (DaoCloud)
9+
10+
The [`kubeadm`](/docs/reference/setup-tools/kubeadm/) tool now supports etcd learner mode, which
11+
allows you to enhance the resilience and stability
12+
of your Kubernetes clusters by leveraging the [learner mode](https://etcd.io/docs/v3.4/learning/design-learner/#appendix-learner-implementation-in-v34)
13+
feature introduced in etcd version 3.4.
14+
This guide will walk you through using etcd learner mode with kubeadm.
15+
16+
In v1.27, kubeadm introduced a new feature gate `EtcdLearnerMode`. With this feature gate enabled,
17+
when joining a new control plane node, a new etcd member will be created as a learner and
18+
promoted to a voting member only after the etcd data are fully aligned.
19+
20+
## What are the advantages of using etcd learner mode?
21+
22+
etcd learner mode offers several compelling reasons to consider its adoption
23+
in Kubernetes clusters:
24+
25+
1. **Enhanced Resilience**: etcd learner nodes are non-voting members that catch up with
26+
the leader's logs before becoming fully operational. This prevents new cluster members
27+
from disrupting the quorum or causing leader elections, making the cluster more resilient
28+
during membership changes.
29+
2. **Reduced Cluster Unavailability**: Traditional approaches to adding new members often
30+
result in cluster unavailability periods, especially in slow infrastructure or misconfigurations.
31+
etcd learner mode minimizes such disruptions.
32+
3. **Simplified Maintenance**: Learner nodes provide a safer and reversible way to add or replace
33+
cluster members. This reduces the risk of accidental cluster outages due to misconfigurations or
34+
missteps during member additions.
35+
4. **Improved Network Tolerance**: In scenarios involving network partitions, learner mode allows
36+
for more graceful handling. Depending on the partition a new member lands, it can seamlessly
37+
integrate with the existing cluster without causing disruptions.
38+
39+
In summary, the etcd learner mode improves the reliability and manageability of Kubernetes clusters
40+
during member additions and changes, making it a valuable feature for cluster operators.
41+
42+
## How nodes join a cluster that's using the new mode
43+
44+
### Create a Kubernetes cluster backed by etcd in learner mode {#create-K8s-cluster-etcd-learner-mode}
45+
46+
For a general explanation about creating highly available clusters with kubeadm, you can refer to
47+
[Creating Highly Available Clusters with kubeadm](/docs/setup/production-environment/tools/kubeadm/high-availability/).
48+
49+
To create a Kubernetes cluster, backed by etcd in learner mode, using kubeadm, follow these steps:
50+
51+
```shell
52+
# kubeadm init --feature-gates=EtcdLearnerMode=true ...
53+
kubeadm init --config=kubeadm-config.yaml
54+
```
55+
56+
The kubeadm configuration file is like below:
57+
58+
```yaml
59+
apiVersion: kubeadm.k8s.io/v1beta3
60+
kind: ClusterConfiguration
61+
featureGates:
62+
EtcdLearnerMode: true
63+
```
64+
65+
The kubeadm tool deploys a single-node Kubernetes cluster with etcd set to use learner mode.
66+
67+
### Join nodes to the Kubernetes cluster
68+
69+
Before joining a control-plane node to the new Kubernetes cluster, ensure that the existing control plane nodes
70+
and all etcd members are healthy.
71+
72+
Before joining a worker node to the new Kubernetes cluster, ensure that the control plane nodes are healthy.
73+
74+
## What's next
75+
76+
- The feature gate `EtcdLearnerMode` is alpha in v1.27 and will we expect it to graduate beta in the next
77+
minor release of Kubernetes (v1.29).
78+
- etcd has an open issue that may make the process more automatic:
79+
[Support auto-promoting a learner member to a voting member](https://github.com/etcd-io/etcd/issues/15107).
80+
- Learn more about the kubeadm [configuration format](/docs/reference/config-api/kubeadm-config.v1beta3/) here.
81+
82+
## Feedback
83+
84+
Was this guide helpful? If you have any feedback or encounter any issues, please let us know.
85+
Your feedback is always welcome! Join the bi-weekly [SIG Cluster Lifecycle meeting](https://docs.google.com/document/d/1Gmc7LyCIL_148a9Tft7pdhdee0NBHdOfHS1SAF0duI4/edit)
86+
or weekly [kubeadm office hours](https://docs.google.com/document/d/130_kiXjG7graFNSnIAgtMS1G8zPDwpkshgfRYS0nggo/edit). Or reach us via [Slack](https://slack.k8s.io/) (channel **#kubeadm**), or the [SIG's mailing list](https://groups.google.com/g/kubernetes-sig-cluster-lifecycle).

0 commit comments

Comments
 (0)