Distributed Locking in Kubernetes

Distributed Locking in Kubernetes

Some say that there is no such thing as “distributed lock”. Still, sooner or later, you’d encounter a problem that only one of your application replicas may execute the given operation at the given time. How to do it right and safe in Kubernetes?

In this session I’ll present the following aspects of distributed locking, all in the context of Kubernetes:

  • using “Lease” resource as a distributed lock
  • using “ConfigMap” resource as a distributed lock
  • using distributed locking libraries (Redis, Hazelcast, Zookeeper)
  • optimistic vs pessimistic locking
  • making locking safe with fencing
  • split-brain issue and the rescue with consensus algorithms
  • real-life use-cases for distributed locking