Skip to content

kubernetes controller exposing a mysql-compatible interface for retrieving the objects within the cluster using SQL

License

Notifications You must be signed in to change notification settings

adalrsjr1/clustersql

Repository files navigation

ClusterSQL

Welcome to the ClusterSQL project! This project aims to provide a convenient way to access Kubernetes objects through a MySQL interface. The controller continuously watches for changes to Kubernetes objects and syncs them with in-memory MySQL, allowing users to use familiar SQL commands to interact with their Kubernetes clusters. Whether you are a MySQL expert looking for an easy way to slice and dice your Kubernetes resources, or just want a new way to visualize with your cluster, this project has something to offer.

This project was possible thanks to go-mysql-server project.

Dependencies

  • Istio
  • Kubernetes Metrics Server
  • Prometheus

Scope of this project

  • Be a convenient SQL-based component on observability stacks to slice and dice cluster informations
  • Provide access to the most common objects (Pods, Containers, Nodes, Metrics, Affinites)

Non-goals:

  • Support all K8s objects
  • Edit K8s cluster through SQL

Build

docker build -t <image> -f ./build/Dockerfile .

Deployment

kubectl apply -f ./deployments

Limitations

ClusterSQL is a read-only interface. Any write query will not change the state of the monitored cluster, though the in-memory tables will be rewritten (TO-FIX).

The SQL limitations are listed in here

Data Model

data-model

Usage

Install mariadb-shell:

[fedora] $ sudo dnf install mariadb-shell

Expose port:

kubectl -n kube-system svc/clustersql 3306:3306

Connect and play:

mysql --host=0.0.0.0 --port=3306 --user=root kubernetes --execute="SELECT * FROM pods";

About

kubernetes controller exposing a mysql-compatible interface for retrieving the objects within the cluster using SQL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages