|
| 1 | +--- |
| 2 | +title: "Kubix: A Smarter CLI Wrapper for kubectl" |
| 3 | +classes: wide |
| 4 | +header: |
| 5 | + teaser: /assets/images/posts/kubix-logo.png |
| 6 | + overlay_image: /assets/images/posts/kubix-logo.png |
| 7 | + overlay_filter: 0.3 |
| 8 | +ribbon: DarkSlateGray |
| 9 | +excerpt: "Kubix is a Rust-powered CLI wrapper around kubectl that simplifies your Kubernetes workflow with smart aliases and powerful UX." |
| 10 | +description: "Introducing Kubix - a lightweight, user-friendly CLI built in Rust to boost kubectl productivity. Learn why and how it was built, and how to use it." |
| 11 | +categories: |
| 12 | + - Projects |
| 13 | + - Kubernetes |
| 14 | +tags: |
| 15 | + - Rust |
| 16 | + - Kubernetes |
| 17 | + - CLI |
| 18 | + - Open Source |
| 19 | + - Dev Tools |
| 20 | + - kubectl |
| 21 | +toc: true |
| 22 | +toc_sticky: true |
| 23 | +toc_label: "Kubix Guide" |
| 24 | +toc_icon: "terminal" |
| 25 | +--- |
| 26 | + |
| 27 | +# Meet Kubix 🧩 |
| 28 | + |
| 29 | +Kubix is a smart CLI wrapper around `kubectl`, written in *Rust*, that helps you run common Kubernetes commands faster and more intuitively. |
| 30 | + |
| 31 | +👉 [GitHub Repo](https://github.com/orez-rj/kubix/tree/main) |
| 32 | + |
| 33 | +## Why I Built It |
| 34 | + |
| 35 | +I wanted to learn Rust. I also wanted to streamline my everyday work with `kubectl`, which often involves typing long repetitive commands and switching contexts or namespaces. |
| 36 | + |
| 37 | +Sure, there are existing scripts and even tools like `kubectl ai`, but building *yet another wrapper* gave me the hands-on experience I needed, and a way to tailor the tool exactly to how I work. No better way to learn a language than solving a problem you care about. |
| 38 | + |
| 39 | +## What Kubix Does |
| 40 | + |
| 41 | +Kubix acts as a shortcut layer on top of `kubectl`. It offers: |
| 42 | + |
| 43 | +- **Faster, cleaner commands** for common tasks (e.g., `kubix pods` instead of `kubectl get pods`) |
| 44 | +- **Context-aware behavior** for easier switching between clusters and namespaces |
| 45 | +- **Aliased commands** for logs, exec, describe, delete, and more |
| 46 | +- **Powerful CLI UX** thanks to Rust's blazing performance and the [`clap`](https://docs.rs/clap/latest/clap/) framework |
| 47 | +- **Extensibility** - future support planned for fuzzy search, natural language (LLM) inputs, and command history |
| 48 | + |
| 49 | +Here’s a taste: |
| 50 | + |
| 51 | +```bash |
| 52 | +# List all pods |
| 53 | +kubix pods |
| 54 | + |
| 55 | +# Execute into a pod |
| 56 | +kubix exec my-app |
| 57 | + |
| 58 | +# View logs |
| 59 | +kubix logs my-app |
| 60 | +``` |
| 61 | + |
| 62 | +### Beautiful CLI Output (Yes, It Sparks Joy) |
| 63 | + |
| 64 | +Kubix isn’t just fast - it’s also pleasant to use. |
| 65 | + |
| 66 | +Using the excellent [`tabled`](https://docs.rs/tabled/) crate, Kubix formats Kubernetes objects (like pods, contexts, etc.) into clean, readable tables that make your terminal feel more like a dashboard. |
| 67 | + |
| 68 | +Example: |
| 69 | + |
| 70 | +```text |
| 71 | ++------+---------------------+-------------+ |
| 72 | +| NAME | NAMESPACE | AGE | |
| 73 | ++------+---------------------+-------------+ |
| 74 | +| web | default | 3h 21m ago | |
| 75 | +| api | production-backend | 7m 42s ago | |
| 76 | ++------+---------------------+-------------+ |
| 77 | +``` |
| 78 | + |
| 79 | +There’s also interactive selection using pattern matching and fuzzy input. |
| 80 | + |
| 81 | +```bash |
| 82 | +kubix exec |
| 83 | +``` |
| 84 | + |
| 85 | +This command will show a numbered list of pods matching your query, and let you select one easily by number or name: |
| 86 | + |
| 87 | +```text |
| 88 | +Which pod do you want to exec into? |
| 89 | +
|
| 90 | +[0] web-5f68d7b9fd-xk4zb |
| 91 | +[1] api-57c4b66dc5-tkp8n |
| 92 | +[2] db-66ccfcbf55-72vvn |
| 93 | +
|
| 94 | +Type number or pattern: |
| 95 | +> 1 |
| 96 | +``` |
| 97 | + |
| 98 | +This kind of UX makes `kubectl` feel almost... friendly. 😄 |
| 99 | + |
| 100 | +### Automated Cross-Platform Releases |
| 101 | + |
| 102 | +One thing I really wanted was to make Kubix **zero-effort to install** on any system. |
| 103 | + |
| 104 | +To achieve that, I set up a fully automated GitHub Action that: |
| 105 | + |
| 106 | +* Detects version bumps via `cargo release` |
| 107 | +* Builds static binaries for Linux, macOS, and Windows |
| 108 | +* Attaches them to a new GitHub release |
| 109 | +* Updates the install script |
| 110 | + |
| 111 | +All of this happens on push to `main` after merging `dev`, so cutting a new release is as easy as: |
| 112 | + |
| 113 | +```bash |
| 114 | +cargo release minor |
| 115 | +``` |
| 116 | + |
| 117 | +Kubix is ready-to-go for anyone, anywhere - no Rust toolchain required. Just download, drop it in your `$PATH`, and start kubing like a pro. |
| 118 | + |
| 119 | +## Under the Hood |
| 120 | + |
| 121 | +Kubix is built using: |
| 122 | + |
| 123 | +* 🦀 **Rust** - For performance and safety |
| 124 | +* 🧼 **Clap** - To parse and structure CLI commands cleanly |
| 125 | +* 📦 **cargo-release + GitHub Actions** - For versioned multi-platform releases |
| 126 | +* 💻 **Cross-platform support** - Tested on Linux and macOS (Windows support planned) |
| 127 | + |
| 128 | +If you want to understand how it works or contribute, check out the source: [orez-rj/kubix](https://github.com/orez-rj/kubix) |
| 129 | + |
| 130 | +## How to Install |
| 131 | + |
| 132 | +Download the latest binary from the [Releases](https://github.com/orez-rj/kubix/releases) page or install with `cargo`: |
| 133 | + |
| 134 | +```bash |
| 135 | +cargo install kubix |
| 136 | +``` |
| 137 | + |
| 138 | +Or use the installer script: |
| 139 | + |
| 140 | +```bash |
| 141 | +curl -sSL https://raw.githubusercontent.com/orez-rj/kubix/main/install.sh | bash |
| 142 | +``` |
| 143 | + |
| 144 | +## Roadmap |
| 145 | + |
| 146 | +* [ ] Add natural language support (`kubix exec to shell in frontend pod`) |
| 147 | +* [ ] Regex matching pod names |
| 148 | +* [ ] Improve Windows support |
| 149 | +* [ ] Optional LLM integration |
| 150 | + |
| 151 | +## Final Thoughts |
| 152 | + |
| 153 | +Kubix is my way of learning Rust while scratching a real itch in my Kubernetes workflow. It’s still growing, and contributions are welcome! |
| 154 | + |
| 155 | +> I’ll probably never stop tweaking it-but that’s half the fun. |
| 156 | +
|
| 157 | +--- |
| 158 | + |
| 159 | +🧑💻 **Project by:** [Or Ezra (orez-rj)](https://github.com/orez-rj) |
| 160 | +📁 **Repo:** [github.com/orez-rj/kubix](https://github.com/orez-rj/kubix) |
0 commit comments