DEV Community

Cover image for Kubernetes Patterns : Singleton-Application Pattern
Ahmed Atef
Ahmed Atef

Posted on • Originally published at magalix.com

Kubernetes Patterns : Singleton-Application Pattern

What is The Singleton Pattern?
The Singleton pattern is one of the creational patterns used in software development. In Object-Oriented programming, a Singleton class refers to one that does not accept other instances to get created. The same concept holds for other domains than application development. For example, let’s assume that you are working on a Red Hat Linux box. Red Hat and its variants (Centos, Fedora, etc.) use yum for package and system updates. On a periodic basis, the operating system contacts its package repositories to download and update the packages that are currently installed. While this operation is in progress, no other yum processes should start. So, if a user tries to use yum to install a package, the system responds that “another installation is already in progress”. The yum process here may be referred to as the “singleton” process: only one instance of yum should be running at any given time. The Singleton pattern is used to maintain consistency and integrity. In the yum example, running multiple instances of the package manager concurrently may break the operating system or make it unstable.
for more information visit: https://www.magalix.com/blog/kubernetes-patterns-singleton-application-pattern

Top comments (0)