Skip to content

Experimental tool to query K8s API using plain SQL

Notifications You must be signed in to change notification settings

Dentrax/kubesql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubesql

An experimental tool for querying your Kubernetes API Server using SQL

MIT GitHub release


kubesql, an experimental tool for querying your Kubernetes API Server using simple and smallest SQL syntax.

$ kubesql -q "SELECT namespace FROM context WHERE pod.status.phase = 'Running'"

Screenshot

Installation

Docker

$ docker pull furkanturkal/kubesql:0.1.0

From Source

$ cargo install --path . # local
# - or -
$ cargo install --git https://github.com/Dentrax/kubesql # remote

Usage

asciicast

USAGE:
    kubesql [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -f, --file <FILE>      
    -q, --query <query>

Evaluate

$ kubesql --file ./kube.sql
$ kubesql --query "SELECT namespace FROM context WHERE pod.status.phase = 'Running'"

With Docker

$ docker container run -v ~/.kube/config/:/home/nonroot/.kube/config kubesql:0.1.0 --query "SELECT namespace FROM context WHERE pod.status.phase = 'Running'"

Quick Start

SQL Syntax

Single Context

SELECT namespace
FROM context
WHERE pod.status.phase = 'Running'

Multiple Context-Namespace

SELECT namespace1, namespace2
FROM context1, context2
WHERE pod.status.phase = 'Running' AND deployment.metadata.name = 'my-awesome-deployment'

Supported Statements

STATEMENT REQUIRED
SELECT
FROM
WHERE

Supported Operators

OPERATOR WHERE ACTION
AND Panic if no result found
OR Continue

Special Thanks

Package Author License
sqlparser ballista-compute Apache License 2.0
kube clux Apache License 2.0
prettytable phsym MIT
  • Thanks to everyone who contributed these libraries and others that made this project possible.

License

kubesql was created by Furkan 'Dentrax' Türkal

The base project code is licensed under MIT unless otherwise specified. Please see the LICENSE file for more information.

FOSSA Status

Best Regards