All posts

K9s Sub-Processors: A Comprehensive Guide for Effective Workflow Management

K9s has become a trusted tool for visualizing and managing Kubernetes clusters, offering engineers a more interactive and efficient way to monitor workloads. But what takes K9s from being a good tool to a great one is its flexibility. Among its most undervalued features is the concept of sub-processors—tools and scripts that allow you to extend K9s' capabilities even further. If you're just hearing about K9s sub-processors for the first time or looking to better integrate them into your process

Free White Paper

Agentic Workflow Security: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

K9s has become a trusted tool for visualizing and managing Kubernetes clusters, offering engineers a more interactive and efficient way to monitor workloads. But what takes K9s from being a good tool to a great one is its flexibility. Among its most undervalued features is the concept of sub-processors—tools and scripts that allow you to extend K9s' capabilities even further.

If you're just hearing about K9s sub-processors for the first time or looking to better integrate them into your processes, this guide will show you what they are, why they matter, and, more importantly, how you can use them to supercharge your Kubernetes workflows.


What Are K9s Sub-Processors?

Sub-processors in K9s are essentially commands, scripts, or tools that are executed within a K9s session. These commands extend K9s' functionality by enabling you to perform custom tasks, invoke external tools, or integrate with other workflows—all without leaving the K9s interface.

For example:

  • You can build a sub-processor to interact with your CI/CD pipelines directly from K9s.
  • Execute pre-configured diagnostics scripts for troubleshooting pods or nodes.
  • Launch specific kubectl commands tailored to your team's needs.

Sub-processors make K9s more than just a "Kubernetes viewer"by enabling a layer of interactivity and automation.


Why Sub-Processors Matter

A common struggle for engineers managing Kubernetes clusters is context switching. Constantly moving between different tools and terminals adds friction to a workflow, reducing productivity and increasing the likelihood of errors.

Sub-processors eliminate this inefficiency:

Continue reading? Get the full guide.

Agentic Workflow Security: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.
  • Improved Automation: Automate repetitive tasks like cleanup jobs or diagnostics.
  • Custom Workflows: Tailor operational workflows to match your team's needs, all accessible from a single interface.
  • Seamless Integration: Quickly pull in tools like kubectl or observability platforms without leaving K9s.

How To Set Up and Use K9s Sub-Processors

Enabling sub-processors in K9s is straightforward if you know where to put your configurations. Sub-processors are configured using the plugin system in K9s. Here’s a quick guide:

Step 1: Locate the Plugin Directory

K9s relies on a configuration file to define sub-processors. Navigate to ~/.k9s/plugin.yml. This is where you’ll add the custom commands or scripts you'll run via your sub-processors.

Step 2: Write Your Plugin Configuration

Each sub-processor is defined as a plugin command inside the YAML file. Here's an example where a sub-processor runs a diagnostics script for a pod:

plugin: 
 diagnostics: 
 shortCut: Ctrl-D 
 description: Run diagnostics for the selected pod 
 scopes: pods 
 command: 
 - bash 
 - -c 
 - ./scripts/pod-diagnostics.sh -p $NAME 
  • shortCut: Key combination to trigger the sub-processor.
  • description: Description of the process visible to users.
  • scopes: Resources within K9s where this applies (e.g., pods, nodes).
  • command: The external command or script you wish to execute.

Step 3: Test and Iterate

After saving your plugin.yml, restart K9s and navigate to the resource you’ve scoped the sub-processor for. Hit the configured shortcut (in this case, Ctrl-D) to see your sub-processor in action.


Best Practices for Using Sub-Processors

Harnessing sub-processors effectively requires some thoughtful planning. Here are a few tips to maximize their impact:

  1. Keep Configurations Version-Controlled: Since you're editing YAML files, store them in a shared, version-controlled repository to ensure consistency across your team.
  2. Align Commands with Team Policies: Ensure any command or script aligns with your organization’s security and operational policies. For example, avoid commands that modify Kubernetes objects directly without prior safeguards.
  3. Test Extensively in Dev: Experiment with sub-processor functionality in non-production environments before rolling it out cluster-wide.

Examples of Sub-Processor Use Cases

Need ideas for how to tailor K9s sub-processors to your workflow? Consider these examples that have been battle-tested in various engineering teams:

  • On-Demand Pod Logs: Quickly fetch and display pod logs filtered by specific keywords.
  • Resource Cleanup: Automate the deletion of unused resources, like old jobs or dangling ConfigMaps.
  • Cluster Diagnostics: Run pre-configured troubleshooting or health-check scripts tied to specific nodes or namespaces.

The possibilities are nearly endless, making K9s sub-processors a powerful addition to any Kubernetes workflow.


Conclusion

K9s is already a must-have for managing Kubernetes clusters efficiently, but sub-processors unlock a whole new level of customization and capability. By integrating your team's unique needs directly into K9s, sub-processors reduce friction, improve workflow efficiency, and enable seamless automation—all inside the tool you already use.

Want to take this further? Hoop.dev helps you analyze your workflows, identify bottlenecks, and see actionable metrics in minutes. Experience how it can complement tools like K9s by taking it for a spin today.

Get started

See hoop.dev in action

One gateway for every database, container, and AI agent. Deploy in minutes.

Get a demoMore posts