Live data from Hacker News

Cyphernetes: A Query Language for Kubernetes

cyphernet.es

21–30 of 69 posts

Re: Cyphernetes: A Query Language for Kubernetes

#21
I really really like Steampipe to do this kind of query: https://steampipe.io, which is essentially PostgreSQL (literally) to query many different kind of APIs, which means you have access to all PostgreSQL's SQL language can offer to request data.

They have a Kubernetes plugin at https://hub.steampipe.io/plugins/turbot/kubernetes and there are a couple of things I really like:

* it's super easy to request multiple Kubernetes clusters transparently: define one Steampipe "connection" for each of your clusters + define an "aggregator" connection that aggregates all of them, then query the "aggregator" connection. You will get a "context" column that indicates which Kubernetes cluster the row came from. * it's relatively fast in my experience, even for large result sets. It's also possible to configure a caching mechanism inside Steampipe to speed up your queries * it also understands custom resource definitions, although you need to help Steampipe a bit (explained here: https://hub.steampipe.io/plugins/turbot/kubernetes/tables/ku...)

Last but not least: you can of course join multiple "plugins" together. I used it a couple of times to join content exposed only in GCP with content from Kubernetes, that was quite useful.

The things I don't like so much but can be lived with:

* Several columns are just exposed a plain JSON fields ; you need to get familiar with PostgreSQL JSON operators to get something useful. There's a page in Steampipe's doc to explain how to use them better. * Be familiar also with PostgreSQL's common table expressions: there are not so difficult to use but makes the SQL code much easier to read * It's SQL, so you have to know which columns you want to pick before selecting the table they come from ; not ideal from autocompletion * the Steampipe "psql" client is good, but sometimes a bit counter intuitive ; I don't have specific examples but I have the feeling it behaves slightly differently than other CLI client I used.

All in all: I think Steampipe is a cool tool to know about, for Kubernetes but also other API systems.

Re: Cyphernetes: A Query Language for Kubernetes

#22

The brew install cyphernetes at the top of the page is an immediate turn-off.

why?..

Kubernetes only runs on linux, so it follows to reason if you care about k8s you should care about linux. My experience is also that good experienced sysadmins often use linux for their own machines as well.

Targetting a tool at macOS users, and omitting linux instructions, gives the impression that the tool isn't targeted at sysadmins or hackers (i.e. at us), but rather at beginners, frontend developers, etc.

Re: Cyphernetes: A Query Language for Kubernetes

#23
post #13

During many years of operating several-thousands of nodes production clusters on Kubernetes, I've never seen any of these observability tools that query kube-apiserver work at that scale. Even the popular tools like k9s make super expensive queries like listing all pods in the cluster that if you don't have enough load protections, can tip your Kubernetes apiserver over and cause an incident. If you're serious about…

how are Kubernetes apiservers suffering this much from this kind of query? Surely even in huge systems the amount of data that would need to be traversed is super small, right?

Is this a question of Kubernetes just sticking everything into "standard" datastructures instead of using a database?

Re: Cyphernetes: A Query Language for Kubernetes

#24
post #20

The brew install cyphernetes at the top of the page is an immediate turn-off.

Agree but I'm not sure why. I'm not a mac user so the initial impression is like "this isn't for you, go away". At least add a linux command alongside it!

Homebrew has a Linux variant, but I assume almost nobody uses it.

Personally use a Mac with Nix, and so do many of my coworkers. Assuming Homebrew, even for a Mac user, leaves a bad impression on me.

Re: Cyphernetes: A Query Language for Kubernetes

#25
post #20

The brew install cyphernetes at the top of the page is an immediate turn-off.

Agree but I'm not sure why. I'm not a mac user so the initial impression is like "this isn't for you, go away". At least add a linux command alongside it!

Thanks for the feedback. Will add more commands there on rotation to show the different installation options.

Re: Cyphernetes: A Query Language for Kubernetes

#27
post #22

Earlier quoted context omitted.

why?..

Kubernetes only runs on linux, so it follows to reason if you care about k8s you should care about linux. My experience is also that good experienced sysadmins often use linux for their own machines as well. Targetting a tool at macOS users, and omitting linux instructions, gives the impression that the tool isn't targeted at sysadmins or hackers (i.e. at us), but rather at beginners, frontend developers, etc.

I'm a "sysadmin". I only run Linux on my workstation. I even run NixOs on a home server. I manager Kubernetes clusters. Yet, I use Homebrew on Linux.

Re: Cyphernetes: A Query Language for Kubernetes

#28
post #22

Earlier quoted context omitted.

Kubernetes only runs on linux, so it follows to reason if you care about k8s you should care about linux. My experience is also that good experienced sysadmins often use linux for their own machines as well. Targetting a tool at macOS users, and omitting linux instructions, gives the impression that the tool isn't targeted at sysadmins or hackers (i.e. at us), but rather at beginners, frontend developers, etc.

I'm a "sysadmin". I only run Linux on my workstation. I even run NixOs on a home server. I manager Kubernetes clusters. Yet, I use Homebrew on Linux.

Most, however, do not, nor should they be expected to. Homebrew is not a safe or viable package manager, especially when better and safer package managers exist in the Linux ecosystem.

Re: Cyphernetes: A Query Language for Kubernetes

#29
This is way cool. The ability to visualize the k8s object model as a graph and query it as such makes so much sense! The hottest feature in my mind is applying this in an operator - maintaining state as defined by a simple graph query. It is much more readable, and does so with very little code. Well Done!

Re: Cyphernetes: A Query Language for Kubernetes

#30
post #15

Earlier quoted context omitted.

Can just use normal jq select filters unless I'm missing something?

the thing is you'd need 3 k8s queries, one for pods, one for deployments, one for services, then link all of them, and filter... jq helps with the filtering, kubectl can query, but you still need to join the 3 resources to answer the query...

Right, so doable just a bit more effort to do 3 queries to pipes or tmp files
Post reply on HN