Files
kubespray/roles/etcd/tasks/clean_v2_store.yml
Takuya Murakami 0bfd43499a Update etcd to 3.6 (#12634)
* [etcd] Update etcd 3.5.x to 3.6.5

- Add hashes for etcd 3.6.5
- Remove etcd v2 backup task for etcd 3.6
  The etcd 3.6 removes 'etcdctl backup' command with ETCDCTL_API=2
- Downgrade etcd to 3.5 in netchecker
  The netchecker does not work with etcd 3.6 becaust it removes v2 API support (--enable-v2).
  And netchekcer does not support v3 API.

* Fix: Change etcd config to clean up v2 store before upgrading etcd to 3.6

* Bump etcd to 3.6.8
2026-02-16 19:16:01 +05:30

44 lines
1.8 KiB
YAML

---
# When upgrading from etcd 3.5 to 3.6, need to clean up v2 store before upgrading.
# Without this, etcd 3.6 will crash with following error:
# "panic: detected disallowed v2 WAL for stage --v2-deprecation=write-only [recovered]"
- name: Cleanup v2 store when upgrade etcd from <3.6 to >=3.6
when:
- etcd_cluster_setup
- etcd_current_version != ''
- etcd_current_version is version('3.6.0', '<')
- etcd_version is version('3.6.0', '>=')
block:
- name: Ensure etcd version is >=3.5.26
when:
- etcd_current_version is version('3.5.26', '<')
fail:
msg: "You need to upgrade etcd to 3.5.26 or later before upgrade to 3.6. Current version is {{ etcd_current_version }}."
# Workarounds:
# Disable --enable-v2 (recommended in 20289) and do workaround of 20231 (MAX_WALS=1 and SNAPSHOT_COUNT=1)
# - https://github.com/etcd-io/etcd/issues/20809
# - https://github.com/etcd-io/etcd/discussions/20231#discussioncomment-13958051
- name: Change etcd configuration temporally to limit number of WALs and snapshots to clean up v2 store
ansible.builtin.lineinfile:
path: /etc/etcd.env
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
loop:
- { regexp: '^ETCD_SNAPSHOT_COUNT=', line: 'ETCD_SNAPSHOT_COUNT=1' }
- { regexp: '^ETCD_MAX_WALS=', line: 'ETCD_MAX_WALS=1' }
- { regexp: '^ETCD_MAX_SNAPSHOTS=', line: 'ETCD_MAX_SNAPSHOTS=1' }
- { regexp: '^ETCD_ENABLE_V2=', line: 'ETCD_ENABLE_V2=false' }
# Restart etcd to apply temporal configuration and prevent some upgrade failures
# See also: https://etcd.io/blog/2025/upgrade_from_3.5_to_3.6_issue_followup/
- name: Stop etcd
service:
name: etcd
state: stopped
- name: Start etcd
service:
name: etcd
state: started