The Evolution of Kubernetes Query Language

In partnership with

TechOps Examples

Hey β€” It's Govardhana MK πŸ‘‹

Along with a use case deep dive, we identify the top news, tools, videos, and articles in the TechOps industry.

Before we begin... a big thank you to today's sponsor WRITER

  • It’s late, and you need to integrate generative AI into your cloud workflows.

  • Try WRITER β€” Human taste. Human tweaks. AI speed.

  • 70% faster, with over 1,000 processes optimized already.

IN TODAY'S EDITION

🧠 Use Case

  • The Evolution of Kubernetes Query Language

πŸš€ Top News

πŸ“½οΈ Videos

πŸ“šοΈ Resources

πŸ› οΈ TOOL OF THE DAY

mapotf - A meta programming tool designed to work with Terraform.

  • Match Terraform blocks using data blocks and define transform blocks to mutate the original code.

  • Update, insert, or remove parts of the Terraform block as needed.

🧠 USE CASE

The Evolution of Kubernetes Query Language

To begin with, why at all do we need to query Kubernetes?

Let me put up some scenarios that would make sense:

  • Tracking down a specific pod in a massive cluster

  • Identifying misconfigured resources causing errors

  • Pinpointing services that aren't adhering to scaling limits

  • Auditing access and security policies across environments

This opens up the discussion on what options we have β€” enter Kube-Query, KubeQL, and Cyphernetes.

Cyphernetes is my favorite – you'll likely agree by the end.

These tools may not solve all use cases but offer better visibility into what's running under the hood.

1. Kube-Query:

Kube-Query is an extension for osquery, a simple yet powerful tool that allows you to query Kubernetes resources using SQL-like syntax.

It streamlines operations by letting you quickly filter, search, and analyze resources like pods, services, and nodes without complex kubectl commands.

Note: When running Kube-Query, you should always pass the -kubeconfig flag, specifying the path to your kubeconfig file.

How Does It work?

Osquery provides extensibility, and Kube-Query bridges the gap between osquery and Kubernetes. It communicates with the Kubernetes API to gather, parse, and present data for osquery to consume.

Ref: aquasec

A simple query looks like this:

Ref: aquasec

2. KubeQL:

KubeQL translates SQL-like queries into Kubernetes API calls, allowing users to filter and join data from various resources like pods, nodes, and services in a structured, readable way for easier handling of complex datasets.

It simplifies querying and enhances visibility across your cluster by combining Kubernetes resources under one query interface.

Kube-Query integrates with osquery for real-time cluster monitoring, while KubeQL focuses on efficient data aggregation and deeper analysis across multiple Kubernetes resources in a single query.

A sample query looks like this:

$ ./kubeql -execute "select pods->metadata->labels as labels from pods"

labels

------

{"app":"redmine-test-2-mariadb","pod-template-hash":"384399387"}

{"app":"redmine-test-2-redmine","pod-template-hash":"411540601"}

{"app":"redmine-test-2-redmine","pod-template-hash":"411540601"}

{"k8s-app":"event-exporter","pod-template-hash":"1421584133","version":"v0.1.5"}

...

3. Cyphernetes:

Cyphernetes is a Cypher-inspired query language for Kubernetes. It blends ASCII-art, SQL, and JSON, allowing us to express Kubernetes operations efficiently, with a fun and creative approach.

There are multiple ways to run Cyphernetes queries:

  • Use the web client by running cyphernetes web and visiting http://localhost:8080

  • Access the interactive shell with cyphernetes shell

  • Run single queries from the command line with cyphernetes query "your query" β€” perfect for scripting and CI/CD pipelines

  • Create DynamicOperators with cyphernetes-operator for on-the-fly Kubernetes workflows

  • Integrate the Cyphernetes API in your own Go programs

A sample query looks like this, with a visualization element:

Ref: Cyphernetes

Cyphernetes' superpower is understanding relationships between Kubernetes resources, allowing connected operations without handling the Kubernetes API directly.

Hope these tools make your Kubernetes life easier and more fun!

Writer RAG tool: build production-ready RAG apps in minutes

RAG in just a few lines of code? We’ve launched a predefined RAG tool on our developer platform, making it easy to bring your data into a Knowledge Graph and interact with it with AI. With a single API call, writer LLMs will intelligently call the RAG tool to chat with your data.

Integrated into Writer’s full-stack platform, it eliminates the need for complex vendor RAG setups, making it quick to build scalable, highly accurate AI workflows just by passing a graph ID of your data as a parameter to your RAG tool.

If you're enjoying TechOps Examples please forward this email to a colleague.

It helps us keep this content free.

Looking to promote your company, product, service, or event to 15,000+ TechOps Professionals? Let's work together.