Skip to content

Commit 313c5e1

Browse files
Technical documentation about the namespace replication mechanism
This commmit introduces technical concepts about the namespace replication: 1. Resources involved. 2. Controllers involved. 3. Namespace replication workflow. 4. Namespace deletion workflow. Co-authored-by: Alex Palesandro <[email protected]>
1 parent 74da9d4 commit 313c5e1

File tree

13 files changed

+506
-134
lines changed

13 files changed

+506
-134
lines changed
129 KB
Loading
112 KB
Loading

docs/images_src/namespace-replication/replication-example.xml

Lines changed: 188 additions & 0 deletions
Large diffs are not rendered by default.

docs/images_src/namespace-replication/replication.xml

Lines changed: 149 additions & 0 deletions
Large diffs are not rendered by default.

docs/pages/concepts/networking/components/network-manager.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The network parameters between two clusters are exchanged using the NetworkConfi
5454
Embedded within the Liqo Network Manager, the IPAM (IP Address Management) is the Liqo module in charge of:
5555
1. Manage networks currently in use in the home cluster.
5656
2. Translate the IP address of an offloaded remote pod (assigned by a foreign cluster) in the corresponding IP address that is visible from the home cluster.
57-
3. Translate Endpoints IP addresses during the [Reflection](../../../offloading/features/api-reflection#Overview).
57+
3. Translate Endpoints IP addresses during the [Reflection](../../../offloading/api-reflection#Overview).
5858

5959

6060
#### Networks management
@@ -113,7 +113,7 @@ The IPAM module achieves this task by keeping track of how foreign clusters have
113113

114114

115115
#### Reflection
116-
The [Reflection](../../../offloading/features/api-reflection#Overview) is one of the most relevant Liqo features; is carried out by the Virtual Kubelet and deals with the replication of local Kubernetes resources on foreign clusters, in particular _Services_ and _Endpoints_.
116+
The [Reflection](../../../offloading/api-reflection#Overview) is one of the most relevant Liqo features; is carried out by the Virtual Kubelet and deals with the replication of local Kubernetes resources on foreign clusters, in particular _Services_ and _Endpoints_.
117117

118118
{{% notice note %}}
119119
After having offloaded a workload, the Virtual Kubelet takes also care of creating the Shadow Pod locally and keeping it updated by inspecting its remote counterpart. During the reflection of an Endpoint instead, the Virtual Kubelet creates the resource on the foreign cluster.
Lines changed: 23 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,46 @@
11
---
2-
title: Offloading
2+
title: Resource Offloading
33
weight: 4
44
---
55

66
## Overview
77

88
The peering process terminates by creating a new virtual node in the home cluster.
9-
According to the Liqo terminology, the new virtual node is called _big node_, as it represents (and aggregates) a subset
10-
of the resources available in the foreign cluster. Conversely, the home cluster becomes what we call a _big cluster_,
11-
as it represents a cluster whose resources span (transparently) across multiple physical clusters.
9+
According to the Liqo terminology, the new virtual node is called *big node*, as it represents (and aggregates) a subset of the resources available in the foreign cluster.
10+
Conversely, the home cluster becomes what we call a *big cluster*, as it represents a cluster whose resources span (transparently) across multiple physical clusters.
1211

13-
In Kubernetes, each physical node is managed by the
14-
[Kubelet](https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/), a process running in the hosting
15-
machine that interfaces with the Kubernetes API server, and handles the lifecycle of the pods scheduled on it.
12+
In Kubernetes, each physical node is managed by the [kubelet](https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/), a process running in the hosting machine that interfaces with the Kubernetes API server and handles the lifecycle of the pods scheduled on it.
1613

17-
Since the foreign cluster is represented by a local (virtual) node in the home cluster, offloading a pod on the remote
18-
cluster correspond to scheduling it on a specific node.
19-
When the virtual Kubelet creates a new pod in the foreign cluster, the foreign scheduler elects one _remote, physical_
20-
node as host for the received pod, while the _remote, physical_ kubelet managing that pod takes care of the containers'
21-
execution.
14+
Since the foreign cluster is represented by a virtual node in the home cluster, offloading a pod on the remote cluster corresponds to scheduling it on a specific node.
15+
When the [virtual kubelet](#virtual-kubelet) creates a new pod in the foreign cluster, the foreign scheduler elects one *remote, physical* node as host for the received pod, while the *remote, physical* kubelet managing that pod takes care of the containers' execution.
2216

23-
According to this mechanism, the offloading of a pod to the foreign cluster is fully compliant with the Kubernetes
24-
control plane: the home cluster can control all the remote jobs by interacting with the big node that models the remote
25-
cluster.
17+
According to this mechanism, the offloading of a pod to the foreign cluster is fully compliant with the Kubernetes control plane: the home cluster can control all the remote jobs by interacting with the big node that represents the remote cluster.
2618

2719
### Virtual Kubelet
2820

29-
The _big node_ is a virtual node, hence it cannot have a real `kubelet` process such as normal (physical) nodes.
30-
Liqo leverages a custom version of the [Virtual kubelet](https://github.com/virtual-kubelet/virtual-kubelet) project for
31-
the management of the virtual node, with the kubelet managing the virtual node that runs as a (containerized) pod as a
32-
part of the Liqo control plane.
33-
In a nutshell, a cluster that peers with `N` foreign clusters will have `N` big nodes, representing the `N` remote
34-
clusters, and it will run `N` instances of the virtual kubelet, each one dedicated to the mapping between the (local)
35-
big node and the corresponding (remote) foreign cluster.
21+
The *big node* is a virtual node, so it cannot have a real kubelet process such as normal physical nodes.
22+
Liqo leverages a custom version of the [virtual kubelet project](https://github.com/virtual-kubelet/virtual-kubelet) for the management of the virtual node.
23+
In a nutshell, a cluster that peers with `N` foreign clusters has `N` big nodes representing the clusters and runs `N` instances of the virtual kubelet process.
3624

37-
Generally speaking, a real Kubelet is in charge of accomplishing two tasks:
38-
* handling the node resources and reconciling its status
39-
* taking the received pods, starting the containers, and reconciling their status in the pod resource.
25+
Generally speaking, a standard kubelet is in charge of accomplishing two tasks:
26+
27+
1. Handling the node resource and reconciling its status.
28+
2. Taking the received pods, starting the containers, and reconciling their status in the pod resource.
4029

4130
Similarly, the virtual kubelet is in charge of:
42-
* creating the virtual node resource and reconciling its status, as described in the
43-
[node-management](features/node-management) section;
44-
* offloading the local pod scheduled on the virtual node to the remote cluster, as described in the
45-
[computing](features/computing) section.
4631

47-
Also, our implementation provides a feature we called "reflection", described [here](features/api-reflection).
32+
1. Creating the virtual node resource and reconciling its status, as described in the [node-management](/concepts/offloading/node-management/#overview) section.
33+
2. Offloading the local pod scheduled on the virtual node to the remote cluster, as described in the [computing](/concepts/offloading/computing#overview) section.
34+
35+
Also, our implementation provides a feature we called "reflection", described [here](/concepts/offloading/api-reflection/#overview).
4836

4937
### Namespace mapping
5038

51-
To make the pods in a certain namespace suitable to be offloaded in the remote cluster, the virtual Kubelet has to face
52-
with the problem of the offloading namespace, i.e., in which namespace of the remote cluster to create the pods.
53-
Further details can be found in the dedicated [section](features/namespace-management).
39+
The virtual kubelet has to face the namespace replication problem to make the pods in a certain namespace suitable to be offloaded.
40+
Further details can be found in the dedicated [section](/concepts/offloading/namespace-replication/#the-liqo-namespace-model).
5441

5542
### Scheduling behavior
5643

57-
The virtual node is created with a specific taint. To make a pod available to be scheduled on that node, that taint must
58-
be tolerated. The toleration is added by a `MutatingWebhook` watching all the pods being created in all the namespaces
59-
labeled with the label `liqo.io/enabled="true"`.
60-
61-
By default, the Kubernetes scheduler selects the eligible node with the highest score (scores are computed on several
62-
parameters, among which the available resources).
44+
The virtual node is created with a specific taint. To make a pod available to be scheduled on a virtual node that taint must be tolerated.
45+
The toleration is added by the Liqo MutatingWebhook watching the pods created in all the namespaces labeled with the label `liqo.io/enabled="true"`.
46+
By default, the Kubernetes scheduler selects the eligible node with the highest score (scores are computed on several parameters, among which the available resources).
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: API reflection
3+
weight: 5
4+
---
5+
6+
### Overview
7+
8+
In addition to the well-known kubelet features, our virtual kubelet implementation provides a feature we called "*reflection*": the offloaded Pods may need some resources to be properly executed in the remote clusters, such as:
9+
10+
* `Services`.
11+
* `Endpoints`.
12+
* `Secret`.
13+
* `ConfigMaps`.
14+
15+
The virtual kubelet itself is in charge of replicating those APIs in the remote cluster by properly operating some translations (e.g., the endpoints addresses have to be translated to point to the home cluster).
16+
17+
{{% notice note %}}
18+
This documentation section is a work in progress
19+
{{% /notice %}}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Computing
3+
weight: 4
4+
---
5+
6+
### Overview
7+
8+
The pod offloading in a foreign cluster involves a two-steps scheduling process, which can be summarized as follows:
9+
10+
- the scheduler of the home cluster selects the *big node* as the best target to run the pod;
11+
- the *big node*, being virtual, cannot run any pod. Hence, the virtual kubelet handling the *big node* involves the foreign cluster scheduler, which will select the best physical node on the foreign cluster.
12+
13+
In addition, the virtual kubelet executes the proper reconciliation processes to allow pods in the home cluster to be up-to-date with the remote ones' status. These processes ensure complete visibility in the home cluster.
14+
15+
### Remote pod resiliency
16+
17+
Due to the properties of the two-step scheduling process, different behaviors can be spotted when deleting a pod running in a foreign cluster:
18+
19+
- The pod is deleted in the **home cluster** (intentionally or by eviction): the remote one has to be immediately deleted. In fact, the home cluster is the owner of the pod, therefore whatever modification to the pod is set, this has to be reflected on the remote pod. Hence, when the pod is deleted in the home cluster, the status of the remote cluster has to be aligned, leading to the deletion of the remote pod.
20+
- The pod is deleted in the **foreign cluster** (intentionally or by eviction): not only the local pod must not be deleted, but the remote pod has to be re-created as soon as possible. The requested pod must be running in the foreign cluster without involving the home cluster unless an unrecoverable condition is detected.
21+
22+
To implement this behavior, a new pod scheduled in the virtual node triggers the Virtual Kubelet to create a new [ReplicaSet](https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/), that ultimately leads to the creation of the pod (through the foreign controller-manager).
23+
24+
Creating a remote ReplicaSet addresses the problem of the remote pod resiliency : once a ReplicaSet is created in the remote cluster, the remote ReplicaSet-controller reconciles its status, leading to the desired number of running pods at any time (the desired amount of replicas for those ReplicaSet is always one).
25+
26+
### Computing resources offloading and reconciliation
27+
28+
The scheme below describes the offloading workflow.
29+
The local pod is referred to as *shadow pod* (because it is a mere local representation of the remote pod).
30+
31+
![](/images/offloading/computing-offloading-overview.svg)
32+
33+
1. A user creates a deployment in the local cluster.
34+
2. The controller-manager detects the new deployment, then
35+
1. Creates the corresponding ReplicaSet;
36+
2. Detects the ReplicaSet creation;
37+
3. Creates the specified amount of Pod replicas.
38+
3. The scheduler detects the creation of the new Pod.
39+
4. The scheduler binds some Pods to the virtual node.
40+
5. The Virtual Kubelet detects that a Pod has been scheduled on the virtual node managed by this process.
41+
7. The Virtual Kubelet creates a remote ReplicaSet having the local Pod as `PodTemplate` field and _one_ replica.
42+
8. The remote controller-manager detects the ReplicaSet.
43+
9. The remote controller-manager creates one Pod starting from the `PodTemplate` field.
44+
10. The Virtual Kubelet detects the creation of the remote offloaded Pod.
45+
11. The Virtual Kubelet keeps the local Pod status updated with the remote one.

docs/pages/concepts/offloading/features/api-reflection.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/pages/concepts/offloading/features/computing.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)