惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Spread Privacy
Spread Privacy
K
Kaspersky official blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Forbes - Security
Forbes - Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
The Last Watchdog
The Last Watchdog
SecWiki News
SecWiki News
Attack and Defense Labs
Attack and Defense Labs
Google DeepMind News
Google DeepMind News
Security Archives - TechRepublic
Security Archives - TechRepublic
S
Secure Thoughts
WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
Security Latest
Security Latest
TaoSecurity Blog
TaoSecurity Blog
Cyberwarzone
Cyberwarzone
S
SegmentFault 最新的问题
Cloudbric
Cloudbric
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
N
Netflix TechBlog - Medium
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
H
Hacker News: Front Page
C
Cybersecurity and Infrastructure Security Agency CISA
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
AWS News Blog
AWS News Blog
AI
AI
G
GRAHAM CLULEY
IT之家
IT之家
P
Privacy & Cybersecurity Law Blog
L
Lohrmann on Cybersecurity
Last Week in AI
Last Week in AI
D
Docker
Recent Announcements
Recent Announcements
O
OpenAI News
T
Threat Research - Cisco Blogs
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
Troy Hunt's Blog
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
A
About on SuperTechFans
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
N
News and Events Feed by Topic

Bin Wang - My Personal Blog

Travel Back to China: 2026 Edition | Bin Wang TCode: An AI Coding Agent Leverages Neovim and Tmux | Bin Wang My 2025 in Review | Bin Wang Music Video Generation with AI | Bin Wang Home Network Setup with OpenWrt and VLANs | Bin Wang Fix ZFS Linux Kernel Dependency on Arch Linux | Bin Wang A Rust CLI Program, Use It with LLM and Convert It to Web UI | Bin Wang My First Rust Project | Bin Wang Download Message Images from Seesaw | Bin Wang My Workflow to Review Articles with LLMs | Bin Wang Why Consensus Shortcuts Fail in Distributed Systems | Bin Wang Improve Books Section of My Blog | Bin Wang Use OpenAPI Instead of MCP for LLM Tools | Bin Wang Travel Back To China: 2025 Edition | Bin Wang A 2-Year Reflection for 2023 and 2024 | Bin Wang Jepsen Test on Patroni: A PostgreSQL High Availability Solution | Bin Wang SBT Task to Build Frontend Components | Bin Wang My MacOS Essentials | Bin Wang Source Code of RSS Brain is Available | Bin Wang
Replace A Dead Node in My High Availability Cluster | Bin Wang
2025-02-01 · via Bin Wang - My Personal Blog

Table of Contents

  1. What Was Lost?
  2. Why Not Recover From Backup?
  3. How to Recover?

Kubernetesinfrastructurehigh availability

In my previous blogs [1][2], I’ve introduced my high availability cluster setup. It works really well: when 1 of the 3 nodes is down, the service either continues to be online, or can be recovered rather quickly (in the case I set service replica to 1 to avoid wasting the resource). However, in the beginning of this year, one node went down not because of regular updates or temporary shutdown for maintenance, but because its system disk died. While it’s annoying to replace the disk and bring it back, it’s actually a good opportunity to verify a dead node can be replaced in my setup. So I will note the steps down in this article. This will be a short one but it shows how easy it is.

What Was Lost?

The dead disk is the system disk. It has the OS, but also has the data for CockroachDB and ElasticSearch. However, since the data for CockroachDB and ElasticSearch is replicated across the cluster, it can be recovered from other machines.

The machine also has a separate disk for CephFS but that disk was not lost. The data in CephFS is also replicated so should be able to recover from other machines as well even if it were dead. But it may need additional setup, like changing the disk uuid in Rook’s Kubernetes manifests.

Why Not Recover From Backup?

First of all, I don’t back up that often because I don’t feel the need considering the data is replicated. Another reason is, I set up this machine based on the usage of offsite online backup. Then I repurposed it for use in this HA cluster. I want to change the secure boot setup because the threat model is different so it doesn’t need such complex boot setup, which is not supported very well by mainstream Linux without TPM 2.0.

Since the data can all be recovered from other machines automatically, it would be easier to just install a fresh OS and some basic infrastructure so that all the service deployments and data can be automatically recovered. This also simulates a dead node situation, so that I have more confidence for recovering from such failures in the future.

How to Recover?

Okay, here we are for the actual recovery steps. It’s very simple:

First, install the OS. Configure basic things like network IP address, ssh, etc. Install things like prometheus-node-exporter if you are using it on other machines.

Next step is to let the node join our Kubernetes cluster. Before that, we can remove the old dead node in the Kubernetes cluster by using the command kubectl delete node ....

Then install k3s: Copy the config file under /etc/rancher/k3s/config.yaml from another machine and adjust the node IP and network interface config. Make sure the config has something like server: https://...:6443 so it will join the existing cluster instead of creating a new cluster. Check the k3s versions on other machines by using kubectl get nodes -o wide. Then install it with curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.31.1+k3s1 sh - assuming v1.31.1+k3s1 is the version.

After k3s is installed, the k3s service should be enabled by default and the node should join our cluster automatically. If the hostname and IP address are the same as the dead machine, the Kubernetes cluster should automatically reschedule the services onto this machine. If there are some failed containers, check the log to see if it’s because the local directory for the storage is missing. In my case, I need to create the local directory for CockroachDB and ElasticSearch, and set the owner to 1000 for ElasticSearch.

At last, we need to make sure CephFS is working. Make sure ceph and rbd can be loaded with modprobe. If so, add them to /etc/modules-load.d to load on boot:

cat /etc/modules-load.d/ceph.conf
ceph
cat /etc/modules-load.d/rbd.conf
rbd