All Projects → yaacov → kubectl-sql

yaacov / kubectl-sql

Licence: Apache-2.0 license
kubectl-sql is a kubectl plugin that use SQL like language to query the Kubernetes cluster manager

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to kubectl-sql

kubectlsafe
Safe operations in kubectl with plugin kubectlsafe
Stars: ✭ 36 (-28%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-blame
Show who edited resource fields.
Stars: ✭ 76 (+52%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-janitor
List Kubernetes objects in a problematic state
Stars: ✭ 48 (-4%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-plugin-ssh-jump
A kubectl plugin to access nodes or remote services using a SSH jump Pod
Stars: ✭ 117 (+134%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-view-webhook
👀 ‼️ This projects aims to visualize critical parts of the admission webhook configuration resource
Stars: ✭ 96 (+92%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-df-pv
kubectl plugin - giving admins df (disk free) like utility for persistent volumes
Stars: ✭ 256 (+412%)
Mutual labels:  kubectl, kubectl-plugin
kube-lineage
A CLI tool to display all dependencies or dependents of an object in a Kubernetes cluster.
Stars: ✭ 238 (+376%)
Mutual labels:  kubectl, kubectl-plugin
rbac-tool
Rapid7 | insightCloudSec | Kubernetes RBAC Power Toys - Visualize, Analyze, Generate & Query
Stars: ✭ 546 (+992%)
Mutual labels:  kubectl, kubectl-plugin
openebsctl
`openebsctl` is a kubectl plugin to manage OpenEBS storage components.
Stars: ✭ 23 (-54%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-gopass
Plugin for kubectl to support reading and writing secrets directly from/to gopass
Stars: ✭ 28 (-44%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-secretdata
A kubectl plugin for viewing decoded Secret data with search flags.
Stars: ✭ 37 (-26%)
Mutual labels:  kubectl, kubectl-plugin
Kubectl Tree
kubectl plugin to browse Kubernetes object hierarchies as a tree 🎄 (star the repo if you are using)
Stars: ✭ 1,962 (+3824%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-iexec
Kubectl plugin to interactively exec into a pod
Stars: ✭ 102 (+104%)
Mutual labels:  kubectl, kubectl-plugin
kubectl-gs
kubectl plugin helping with custom resources by Giant Swarm
Stars: ✭ 36 (-28%)
Mutual labels:  kubectl, kubectl-plugin
Ketall
Like `kubectl get all`, but get really all resources
Stars: ✭ 233 (+366%)
Mutual labels:  resources, kubectl
Query Translator
Query Translator is a search query translator with AST representation
Stars: ✭ 165 (+230%)
Mutual labels:  query
Termsql
Convert text from a file or from stdin into SQL table and query it instantly. Uses sqlite as backend. The idea is to make SQL into a tool on the command line or in scripts.
Stars: ✭ 230 (+360%)
Mutual labels:  query
Sqldb Logger
A logger for Go SQL database driver without modify existing *sql.DB stdlib usage.
Stars: ✭ 160 (+220%)
Mutual labels:  query
Fselect
Find files with SQL-like queries
Stars: ✭ 3,103 (+6106%)
Mutual labels:  query
wikit
Wikit - A universal lookup tool
Stars: ✭ 149 (+198%)
Mutual labels:  query

Go Report Card Build Status License

kubectl-sql Logo

kubectl-sql

kubectl-sql is a kubectl plugin that use SQL like language to query the Kubernetes cluster manager

More docs

Install

Using krew plugin manager to install:

kubectl krew install sql
kubectl sql --help

Using Fedora Copr:

dnf copr enable yaacov/kubesql
dnf install kubectl-sql

From source:

git clone [email protected]:yaacov/kubectl-sql.git
cd kubectl-sql

make

What can I do with it ?

kubectl-sql let you select Kubernetes resources based on the value of one or more resource fields, using human readable easy to use SQL like query language. It is also posible to find connected resources useing the join command.

More kubectl-sql examples

# Get all pods from current namespace scope, that has a name starting with "virt-" and
# IP that ends with ".84"
kubectl-sql get pods where "name ~= '^virt-' and status.podIP ~= '[.]84$'"
AMESPACE	NAME                          	PHASE  	hostIP        	CREATION_TIME(RFC3339)       	
default  	virt-launcher-test-bdw2p-lcrwx	Running	192.168.126.56	2020-02-12T14:14:01+02:00
...
# Get all persistant volume clames that are less then 20Gi, and output as json.
kubectl-sql -o json get pvc where "spec.resources.requests.storage < 20Gi"
...
# Display non running pods by nodes for all namespaces.
kubectl-sql join nodes,pods on \
    "nodes.status.addresses.1.address = pods.status.hostIP and not pods.phase ~= 'Running'" -A
...
# Filter replica sets with less ready-replicas then replicas"
kubectl-sql --all-namespaces get rs where "status.readyReplicas < status.replicas"

Output formats:

--output flag Print format
table Table
name Names only
yaml YAML
json JSON

Alternatives

jq

jq is a lightweight and flexible command-line JSON processor. It is possible to pipe the kubectl command output into the jq command to create complicated searches ( Illustrated jq toturial )

https://stedolan.github.io/jq/manual/#select(boolean_expression)

kubectl --field-selector

Field selectors let you select Kubernetes resources based on the value of one or more resource fields. Here are some examples of field selector queries.

https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].