Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add high availability article #173

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ ExpandedRepoInfo
ExpandedRepoInfo
ExtensionList
ExternalName
failover
Filebeat
filesystem
filesystems
Expand Down
40 changes: 40 additions & 0 deletions docs/articles/high-availability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Deploying a Highly Available zot Registry

> :point_right: A highly available zot registry can be easily implemented using zot's registry synchronization feature.

In the zot configuration, the `sync` extension allows a zot instance to mirror another zot instance with various container image download policies, including on-demand and periodic downloads. You can use the zot `sync` function combined with a load balancer such as [HAProxy](https://www.haproxy.com) to implement a highly available registry.

Two failover configurations are possible:

* Active/active
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would make active/active as second option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapped order of A/S and A/A in the intro and in the configuration sections


Registry requests are load-balanced between two zot instances, each of which mirrors the other.

* Active/standby

Registry requests are sent by the load balancer to the active zot instance, while a standby instance mirrors the active. If the load balancer detects a failure of the active instance, it then sends requests to the standby instance.

> :pencil2: The highly available zot registry described in this article differs from [zot clustering](clustering.md). Although zot clustering provides a level of high availability, the instances share common storage, whose failure would affect all instances. In the method described in this article, each instance has its own storage, providing an additional level of safety.

For details of configuring the `sync` extension, see [OCI Registry Mirroring With zot](mirroring.md).

## Configuring an active/active registry

An active/active zot registry can be implemented between two zot instances by configuring the `sync` extension in each instance to point to the other instance. In this scheme:

* a load balancer such as HAProxy or a [DNS-based routing](https://coredns.io/plugins/loadbalance/) scheme is deployed for round-robin load balancing between zot instances
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore, one has to manage traffic split (path based routing) so some traffic goes to one instance and rest goes to another.
https://www.haproxy.com/blog/path-based-routing-with-haproxy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this to keep a repo from being fragmented across two instances?

* each zot instance is configured as a standalone registry with its own storage
* each zot instance has its `sync` extension enabled to periodically synchronize with the other instance

With periodic synchronization, a window of failure exists between synchronization actions. For example, if an image is posted to instance A soon after instance B has synchronized with instance A, and then instance A fails, instance B will not have the new image. To minimize this exposure, we recommend keeping the synchronization period as small as practical.


## Configuring an active/standby registry

An active/standby zot registry can be implemented between two zot instances by configuring the `sync` extension in the standby instance to mirror the other instance. In this scheme:

* a load balancer such as HAProxy is deployed for active/passive load balancing of the zot instances
* each zot instance is configured as a standalone registry with its own storage
* the standby zot instance has its `sync` extension enabled to periodically synchronize with (mirror) the active instance

With periodic synchronization, this scheme is also susceptible to the window of failure described in the active/active case. To minimize this exposure, we recommend keeping the synchronization period as small as practical.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ nav:
- Mirroring: articles/mirroring.md
- Clustering: articles/clustering.md
- Scale-out clustering: articles/scaleout.md
- Deploying a Highly Available Registry: articles/high-availability.md
- Monitoring: articles/monitoring.md
- Using GraphQL for Enhanced Searches: articles/graphql.md
- Benchmarking with zb: articles/benchmarking-with-zb.md
Expand Down
Loading