You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/kubernetes_ecs.md
+35-7Lines changed: 35 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,13 @@
8
8
While prototyping we used many Kubernetes clusters, namely [`kind`](https://kind.sigs.k8s.io/), [`minikube`](https://minikube.sigs.k8s.io/docs/) and [`k3s`](https://k3s.io/)
9
9
in both local and remote cluster deployment. We used Openstack for remote deployment.
10
10
Follow the guides at the individual distributions in order to create the desired cluster setup.
11
-
k3s is recommended to run this prototype, as it is lightweight
12
-
and easily installed distribution which is also [`CNCF`](https://www.cncf.io/training/certification/) certified.
11
+
k3s is recommended to run this prototype, as it is lightweight and easily installed distribution
12
+
which is also [`CNCF`](https://www.cncf.io/training/certification/) certified. However kubernetes
13
+
operator patterns used in this repo should be k8s distribution agnostic.
13
14
14
15
All settings of `k3s` were used as default except one: locked-in-memory size. Use `ulimit -l` to learn
15
16
what is the limit for the current user and `LimitMEMLOCK` inside the k3s systemd service config
16
-
to set it for correct value. Right now the `flp` user has unlimited size (`LimitMEMLOCK=infinity`).
17
+
to set it for correct value. Right now the `flp` user should have unlimited size (`LimitMEMLOCK=infinity`).
17
18
This config is necessary because even if you are running Pods with the privileged security context
18
19
under user flp, Kubernetes still sets limits according to its internal settings and doesn't
19
20
respect linux settings.
@@ -23,14 +24,41 @@ is ability to run Pods with privileged permissions and also under user `flp`.
23
24
This means that the machine has to have `flp` user setup the same way as
24
25
if you would do the installation with [`o2-flp-setup`](https://alice-flp.docs.cern.ch/Operations/Experts/system-configuration/utils/o2-flp-setup/).
25
26
26
-
## Task Controller
27
+
## Operator pattern
27
28
28
-
Following text assumes that there is a Task Controller from `control-operator` running
29
-
at your K8s cluster and Task CRD installed at your cluster.
30
-
You can find the details about the usage in the [documentation](/control-operator/README.md).
29
+
Any communication between kubernetes and OCC tasks and ECS and kubernetes is based on [operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).
30
+
All operator pattern code implemented and expected to be used and deployed by ECS is located in the folder `control-operator`
31
+
with [README.md](/control-operator/README.md).
32
+
33
+
## Direct ECS <-> Kubernetes bridge
34
+
35
+
Apart from the old way of deploying tasks via Apache Mesos ECS now supports deployment of tasks
36
+
directly to the Kubernetes as well and it is up to Admin/User to decide where the task should run.
37
+
In order for Task to be deployed in Kubernetes cluster we need to have environment and task managers
38
+
running inside the cluster as these are responsible for managing Custom Resource Definitions of Task and Environment.
39
+
40
+
The bridge works as follows:
41
+
42
+
1.**ECS core** (running outside the cluster) uses a typed Kubernetes client (`control-operator/pkg/client`) backed by `controller-runtime` to interact with the cluster.
43
+
2. When ECS deploys a task whose control mode is `kubernetes_direct` or `kubernetes_fairmq`, it creates a **Task CRD** and, if needed, an **Environment CRD** in the cluster instead of submitting a Mesos offer.
44
+
3. Inside the cluster, the **task-manager** and **environment-manager** operators (see `control-operator/cmd/`) watch these CRDs and reconcile the desired state — scheduling Pods, driving OCC gRPC state transitions, and writing status back into the CRD.
45
+
4. ECS watches the CRDs via the Kubernetes Watch API and reacts to status changes exactly as it would to Mesos task updates, keeping the rest of the ECS state machine intact.
46
+
47
+
This design lets ECS reuse its existing environment lifecycle, configuration generation, and monitoring logic while outsourcing Pod scheduling and OCC communication to the in-cluster operators. The relevant code can be found in manager.go and managerk8s.go.
48
+
The manager.go implements the split between Mesos and K8s tasks while managerk8s.go implements actual creation, deployment, transitioning and updating ECS structure.
49
+
50
+
To deploy a Kubernetes task you can in principle reuse existing control-workflow task YAML manifests by changing the control mode to `kubernetes_direct` or `kubernetes_fairmq`. But in practice there can be issues
51
+
with reusing existing manifests, for example bad quotation of arguments: Mesos runs tasks via shell, which interpreted and stripped quotation from commands. For this reason you can find ready-to-use manifests with all necessary changes
0 commit comments