xanderdunn / kube-state-rs

A stateless Kubernetes service in Rust to preserve node state between removing and adding nodes in a cluster
0 stars 0 forks source link

Problem

Within a Kubernetes cluster, nodes are often added/deleted as they undergo maintenance with cloud providers. When this happens, metadata stored in the Kubernetes "Node" object is lost. This can be undesirable when using dedicated capacity, as you would like some data such as any Node labels to be kept across the node leaving/entering the cluster.

Write a service that will preserve Nodes’ labels if they are deleted from the cluster and re-apply them if they enter back into the cluster. This service itself should be stateless, but can use Kubernetes for any state storage.

High Level Design

We have two services. One stores versioned transactions on node addition or deletion. The other service processes these transactions in a FIFO manner. We have arbitrary horizontal scalability, high available, arbitrary replication, idempotent versioned transactions, eventual consistency, per-node parallelism (per-node leader election) across a FIFO queue of transactions, stateless services. we rely on the strong consistency of Kubernetes ConfigMaps, which use RAFT-based etcd.

Service: Watcher

Replicas of the Watcher service provide redundant work to ensure high availability. Node names are SHA256 hashed to a fixed 64 hexadecimal character length to prevent exceeding the 253 character limit of a ConfigMap name.

Service: Transaction Processor

Replicating the Transaction Processor service provides both horizontal scaling and high availability. Each replica does non-overlapping work to process the transactions recorded by the Watcher.

Potential Issues:

Edge Cases:

Setup

Build

Lint

Test

Assumptions

Fault Tolerance

We want to achieve availability and eventual consistency in the face of: