© Atos Spain S.A. 2018
Rotterdam is a native-cloud Infrastructure-as-a-Service (IaaS) facade which facilitates the deployment and life cycle management of containerized tasks on container orchestration platforms. Its main purpose is to upload, organize, run, manage and stop sets of containers (named tasks) through API calls, and abstract all the resource infrastructure details, even the concept of cluster of machines/instances, to micro-service developers (in the case of CLASS, data analytics application/service developers.
Rotterdam is part of the CLASS Project (Edge and Cloud Computation: A Highly Distributed Software for Big Data Analytics): https://class-project.eu/
A docker image can be downloaded from https://hub.docker.com/r/atosclass/rotterdam-caas.
- Docker (https://docs.docker.com/install/)
- Golang (when using Github code to compile and generate the executable) (https://golang.org/doc/install)
- Kubernetes (https://kubernetes.io/docs/setup/) / MicroK8s (microKubernetes) (https://microk8s.io/) / Openshift-OKD (https://docs.okd.io/latest/install/index.html)
The requirements for installing the other tools that are part of the cloud platform, Openshift (or Kubernetes) and the monitoring tools, can be found in the following links:
- Openshift (version 3.10) https://docs.openshift.com/container-platform/3.10/install/prerequisites.html
- Kubernetes https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
- Prometheus, Prometheus Pushgateway and Grafana As these tools are provided as docker images, they can be installed in the container orchestrator (Openshift or Kubernetes). Thus, in this kind of environment, they only require the containers orchestrator.
To install an Openshift cluster, users can use the following guide: https://docs.openshift.com/container-platform/3.10/install/index.html This guide is specific for Openshift version 3.10, the one used in the Modena Data Center cluster during the project. At the time of writing this document there is a newer versions of Openshift: 4.4 As Openshift requires certain security features, the installation will require more steps and will be more constrained to certain Linux releases, like Centos or RHEL. By contrast, the installation of a Kubernetes cluster is less complex. Users can follow the guides provided by Kubernetes, which include the installarion of Kubernetes in multiple or single hosts (MicroK8s): https://kubernetes.io/docs/setup/
The last version of the SLA and Rotterdam can also be found in Docker Hub as containerized docker images.
Rotterdam https://hub.docker.com/r/atosclass/rotterdam-caas
SLALite component https://hub.docker.com/r/atosclass/slalite
-
You can download the repository and create the docker image:
sudo docker build -t rotterdam . sudo docker run -p 8333:8333 rotterdam
-
You can also run Rotterdam in Docker by pulling the image from Docker Hub:
docker pull atosclass/rotterdam-caas:1.10.7 docker run [OPTIONS] atosclass/rotterdam-caas:1.10.7 [COMMAND] [ARG...]
-
Finally, to run Rotterdam in Openshift, deploy the image from Docker Hub using the OKD UI. The following environment variables can be defined:
- KubernetesEndPoint (e.g.) "http://X.X.X.X:8001"
- OpenshiftEndPoint (e.g.) "https://X.X.X.X:8443"
- ServerIP (e.g.) "192.168.7.28"
- OpenshiftOauthToken (e.g.) "eyJhbGciOiJSUzI1 ... 3MiOiJrdWJlcm5ldGVzL3Nlc"
- SLALiteEndPoint (e.g.) "http://rotterdam-slalite.X.X.X.X.nip.io"
- PrometheusPushgatewayEndPoint (e.g.) "http://pushgateway.X.X.X.X.nip.io"
The SLALiteEndPoint is used to automatically generate SLAs and to stop or terminate them. The SLALite component should also point to Rotterdam to send it the violations.
- In OKD Web UI, go to selected project / namespace, i.e. the default namespace, and select
Add to project > Deploy Image
- Select
Image Name
atosclass/slalite:0.9.1
- Name:
rotterdam-slaliteXXX
- Environment Variables:
UrlPrometheus
,UrlRotterdam
,MetricsPrometheus
- Name:
atosclass/rotterdam
- Name:
rotterdam-caasXXX
- Environment Variables:
OpenshiftOauthToken
- Name:
- Deploy
- Go to new application / deplopyment and select
Create Route
- SLALite - Hostname:
rotterdam-slalite.X.X.X.X.nip.io
- Rotterdam - Hostname:
rotterdam-cass.X.X.X.X.nip.io
- SLALite - Hostname:
- OpenshiftOauthToken: the value of this token has to be created manually after installing Openshift and configuring users and permissions. This variable is supported only when using Openshift. In the case of Kubernetes this variable is not needed.
- SLALiteEndPoint: this is the URL of the SLA Manager
- PrometheusPushgatewayEndPoint (optional): if there are applications that need to use this tool to push metrics to Prometheus, then the value has to be set
- MaxAllowed (optional): Maximun number of violations allowed before sending a notification to the Adaptation Engine. This is a default value used by the platform to decide when to generate a violation in order to take the required actions.
- MaxReplicas (optional): Default maximun number of replicas allowed per application. In the case one application needs to be scaled our, this value is used to limit the number of replicas.
Example:
{
"CaaSVersion": "1.7.1",
"RulesEngineVersion": "1.0.2",
"RestApiVersion": "1.7.1",
"IMECVersion": "0.0.3",
"SLALiteVersion": "0.6.13",
"ServerPort": 8333,
"Clusters": [{
"ID": "maincluster",
"Name": "Default",
"Description": "Main cluster",
"Type": "Openshift",
"KubernetesEndPoint": "http://X.X.X.X:8001",
"OpenshiftEndPoint": "https://X.X.X.X:8443",
"HostIP": "192.168.7.28",
"OpenshiftOauthToken": "aeeyJhbGciOi32JSUzI1NiIs....5VeNb12oaV7Iwzx",
"SLALiteEndPoint": "http://rotterdam-slalite.X.X.X.X.nip.io",
"PrometheusPushgatewayEndPoint": "http://pushgateway.X.X.X.X.nip.io"
},
{
"ID": "microk8s_1",
"Name": "microk8s_1",
"Description": "microk8s in Edge device",
"Type": "microk8s",
"KubernetesEndPoint": "http://X.X.X.X:8001",
"HostIP": "192.168.1.34",
"SLALiteEndPoint": "http://X.X.X.X:8090",
"PrometheusPushgatewayEndPoint": "http://pushgateway.X.X.X.X.nip.io",
"User": "vagrant",
"Password": "vagrant",
"HostPort": 22
}],
"SLAs": {
"CreationDate": "2019-01-01T00:00:00Z",
"ExpirationDate": "2024-01-01T00:00:00Z"
},
"Tasks": {
"MaxReplicas": 30,
"MinReplicas": 1,
"MaxAllowed": 2,
"ScaleFactor": 1.25,
"Value": 2,
"Comparator": "<",
"Action": "scale_out"
}
}
##########################################
FROM golang:alpine as builder
RUN apk add --no-cache git curl
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
WORKDIR /go/src/atos/rotterdam
COPY . .
RUN go get -d -v ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -o Rotterdam .
##########################################
FROM alpine:3.6
WORKDIR /opt/rotterdam
COPY --from=builder /go/src/atos/rotterdam/Rotterdam .
COPY run_rotterdam.sh run_rotterdam.sh
COPY ./config/config.json ./config/config.json
COPY ./config/qos_templates.json ./config/qos_templates.json
COPY ./rest-api ./rest-api
RUN chmod 775 /opt/rotterdam/run_rotterdam.sh
EXPOSE 8333
ENTRYPOINT ["/opt/rotterdam/run_rotterdam.sh"]
Once Rotterdam is deployed, you can access it through the REST API UI provided by swagger: (e.g. http://rotterdam-caas.X.X.X.X.nip.io/swaggerui/)
The following methods have been defined:
-
To get information about Rotterdam
- GET /api/v1/version
-
The following method is used by the SLALite component to send Rotterdam violations and notifications
- POST /api/v1/sla/tasks/{id}/guarantee/{guarantee}
-
To get all running tasks
- GET /api/v1/tasks
-
To create a new tasks in Rotterdam
- POST /api/v1/tasks
-
To view / manage tasks
- GET /api/v1/tasks/{name}
- DELETE /api/v1/tasks/{name}
-
To get all orchestrators to be managed by Rotterdam
- GET /api/v1/imec
-
To create a new orchestrators to be managed by Rotterdam
- POST /api/v1/imec
-
QoS templates
- POST /api/v1/qos/definitions (creates a new QoS template)
- GET /api/v1/qos/definitions
- GET /api/v1/qos/definitions/{name}
{
"ID": "maincluster",
"Name": "k8s",
"Description": "main cluster",
"DefaultDock": "class",
"Type": "Kubernetes",
"SO": "ubuntu18",
"KubernetesEndPoint": "http://X.X.X.X:8001",
"HostIP": "192.168.7.42",
"SLALiteEndPoint": "http://rotterdam-slalite.X.X.X.X.nip.io",
"PrometheusPushgatewayEndPoint": "http://pushgateway.X.X.X.X.nip.io",
"PrometheusEndPoint": "http://X.X.X.X:32679",
"User": "vagrant",
"Password": "vagrant",
"HostPort": 22
}
{
"name": "adas-my-nginx",
"dock": "default",
"qos": {
"name": "KubeletTooManyPods",
"description": "scale down task if cluster pods > 20",
},
"replicas": 10,
"containers": [{
"name": "adas-my-nginx-app",
"image": "nginx",
"ports": [
{
"containerPort": "80",
"hostPort": "80",
"protocol": "tcp"
}
],
"volumes": [
{
"name": "PATH",
"mounthPath": "/usr/share/class/vol/"
}],
"environment": [
{
"name": "TEST_VAL",
"value":"1.2.3"
}
]}
]
}
{
"name": "redis-app-2",
"dock": "class",
"qos": {
"name": "KubeletTooManyPods",
"description": "scale down task if cluster pods > 20"
},
"replicas": 4,
"containers": [
{
"name": "redis",
"image": "redis",
"ports": [
{
"containerPort": 6379,
"hostPort": 6379,
"protocol": "tcp"
}
]
}
]
}
{
"name": "redis-app",
"replicas": 4,
"image": "redis",
"qos": [{"qosid": "deadlines001", "metric": "missed_deadlines_001", "comparator": "=", "value": 35, "action": "scale_out", "maxreplicas": 25, "minreplicas": 2, "scalefactor": 1.5, "maxallowed": 2}],
"ports": [6379]
}
QoS templates used to define the SLAs associated to the tasks managed by Rotterdam.
QoS | description | description | source, job |
---|---|---|---|
KubeletTooManyPods | infra | scale down task if total of cluster pods is > 20 | Prometheus - kubernetes-nodes-cadvisor |
KubeletPodsLessThan100 | infra | scale down task if total of cluster pods is > 100 | Prometheus - kubernetes-nodes-cadvisor |
KubeletPodsMoreThan100 | infra | scale up task if total of cluster pods is < 100 | Prometheus - kubernetes-nodes-cadvisor |
Test_Prometheus_01 | infra | force a task to be scaled up | Prometheus - kubernetes-nodes-cadvisor |
-
KubeletTooManyPods
:{ "qos": { "name": "KubeletTooManyPods", "description": "scale down task if cluster pods > 20" } }
KubeletTooManyPods QoS is equivalent to the following:
"custom": [{ "guarantees": [{"metric": "kubelet_running_pod_count", "condition": "<", "value": "50"}], "action": "scale_down", "scalefactor": 2, "max": 30, "min": 1, "type": "infr", "name": "cluster_pods_less_50", "description": "scale down task if cluster pods > 50" }]
-
Test01
:{ "qos": { "name": "Test_Prometheus_01", "description": "scale up task if go_memstats_frees_total metric is less than 500000" } }
Rotterdam
is licensed under Apache License, version 2.