Skip to content

openshift-online/maestro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

429 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ask DeepWiki

Maestro

Maestro is a system to leverage CloudEvents to transport Kubernetes resources to the target clusters, and then transport the resource status back. The resources are stored in a database and the status is updated in the database as well. The system is composed of two parts: the Maestro server and the Maestro agent.

  • The Maestro server is responsible for storing the resources and their status. And sending the resources to the message broker in the CloudEvents format. The Maestro server provides Resful APIs and gRPC APIs to manage the resources.
  • Maestro agent is responsible for receiving the resources and applying them to the target clusters. And reporting back the status of the resources.

Architecture

Taking MQTT as an example:

Maestro Architecture

See the Maestro documentation for details.

Why

Maestro was created to address several critical challenges associated with managing Kubernetes clusters at scale. Traditional Kubernetes native and custom resources rely heavily on etcd, which has well-known limitations in terms of scalability and performance. As the number of clusters increases, the strain on etcd can lead to significant issues, making it difficult to achieve high-scale Kubernetes cluster management. To overcome these challenges, Maestro introduces a system that leverages a traditional relational database for storing relevant data, providing a more scalable and efficient solution.

Motivations

Scalability: Kubernetes-based solutions often face scalability issues due to the limitations of etcd. Maestro aims to overcome these issues by decoupling resource management from the etcd store, allowing for more efficient handling of a large number of clusters. This approach supports the goal of managing up to 200,000+ clusters without linear scaling of the infrastructure.

Cost Effectiveness: Running a central orchestrator in a Kubernetes-based environment can be costly. Maestro reduces infrastructure and maintenance costs by leveraging a relational database and optimized content delivery mechanisms.

Improve Feedback Loop: Traditional Kubernetes solutions have limitations in the feedback loop, making it difficult to observe the state of resources effectively. Maestro addresses this by providing a robust feedback loop mechanism, ensuring that resource status is continuously updated and monitored.

Improve Security Architecture: Maestro enhances security by eliminating the need for kubeconfigs, reducing the need for direct access to clusters.

Run in KinD Cluster

You can run the maestro in a KinD cluster locally.

$ make test-env

This creates a KinD cluster with name maestro, and deploys the maestro server and agent in the cluster. The Kubeconfig of the KinD cluster is in ./test/_output/.kubeconfig.

$ export KUBECONFIG=$(pwd)/test/_output/.kubeconfig
$ kubectl -n maestro get svc
NAME                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
maestro               NodePort    10.96.143.3     <none>        8000:30080/TCP   7m42s
maestro-db            ClusterIP   10.96.53.61     <none>        5432/TCP         7m59s
maestro-grpc          NodePort    10.96.114.161   <none>        8090:30090/TCP   7m42s
maestro-healthcheck   ClusterIP   10.96.67.145    <none>        8083/TCP         7m42s
maestro-metrics       ClusterIP   10.96.201.253   <none>        8080/TCP         7m42s
maestro-mqtt          ClusterIP   10.96.241.85    <none>        1883/TCP         7m59s

$ kubectl get pods -n maestro
NAME                             READY   STATUS    RESTARTS   AGE
maestro-85c847764-4xdt6          1/1     Running   0          5m
maestro-db-65f57d978c-c68        1/1     Running   0          5m
maestro-mqtt-6cb7bdf46c-kcczm    1/1     Running   0          5m
$ kubectl get pods -n maestro-agent
NAME                             READY   STATUS    RESTARTS   AGE
maestro-agent-5dc9f5b4bf-8jcvq   1/1     Running   0          3m

Now you can create and manage resource bundles using the Maestro CLI. See the ResourceBundle Commands documentation for details.

Run in OpenShift

If you are using an OpenShift cluster in the cloud, you need to export Kubeconfig to point to your cluster and skip the CRC login step. If you are using CodeReady Containers (CRC) locally, you need to login to the CRC cluster first.

Log into CRC

Use OpenShift Local to deploy to a local openshift cluster. Be sure to have CRC running locally:

$ crc status
CRC VM:          Running
OpenShift:       Running (v4.13.12)
RAM Usage:       7.709GB of 30.79GB
Disk Usage:      23.75GB of 32.68GB (Inside the CRC VM)
Cache Usage:     37.62GB
$ make crc/login
Logging into CRC
Logged into "https://api.crc.testing:6443" as "kubeadmin" using existing credentials.

You have access to 66 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".
Login Succeeded!

Set external_apps_domain

You need to set the external_apps_domain environment variable to point your cluster.

$ export external_apps_domain=`oc -n openshift-ingress-operator get ingresscontroller default -o jsonpath='{.status.domain}'`

Deploy Maestro

If you want to push the image to your OpenShift cluster default registry and then deploy it to the cluster. You need to follow this document to expose a default registry manually and login into the registry with podman. Then run make push to push the image to the registry.

If you want to use the default image, you can skip the make push step.

$ make deploy

$ oc get pod -n maestro
NAME                            READY   STATUS      RESTARTS   AGE
maestro-85c847764-4xdt6         1/1     Running     0          62s
maestro-db-5d4c4679f5-r92vg     1/1     Running     0          61s
maestro-mqtt-6cb7bdf46c-kcczm   1/1     Running     0          63s

Create a Consumer

$ curl -k -X POST -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    https://maestro-maestro.${external_apps_domain}/api/maestro/v1/consumers \
    -d '{
    "name": "cluster1"
  }'

You should get a response like this:

{
  "created_at":"2023-12-08T11:35:08.557450505Z",
  "href":"/api/maestro/v1/consumers/3f28c601-5028-47f4-9264-5cc43f2f27fb",
  "id":"3f28c601-5028-47f4-9264-5cc43f2f27fb",
  "kind":"Consumer",
  "name":"cluster1",
  "updated_at":"2023-12-08T11:35:08.557450505Z"
}

Deploy Maestro Agent

$ export consumer_name=cluster1
$ export install_work_crds=false
$ make deploy-agent
$ oc get pod -n maestro-agent
NAME                             READY   STATUS    RESTARTS   AGE
maestro-agent-5dc9f5b4bf-8jcvq   1/1     Running   0          13s

Now you can create and manage resource bundles using the Maestro CLI. See the ResourceBundle Commands documentation for details.

Run Maestro server with binary

See the Server Command for details.

About

Maestro Service Repo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors