rtk-ai/rtk

feat: comprehensive Kubernetes (kubectl) ecosystem support

Open

#857 opened on Mar 26, 2026

View on GitHub
 (1 comment) (6 reactions) (0 assignees)Rust (2,914 forks)batch import
area:clieffort-largeeffort-mediumenhancementhelp wantedpriority:medium

Repository metrics

Stars
 (48,085 stars)
PR merge metrics
 (Avg merge 11d 1h) (45 merged PRs in 30d)

Description

Context

RTK has basic kubectl support (pods, services, logs) in src/container.rs but many common commands and global flags are missing.

Current state

Command Status Filter
kubectl get pods Rust Compact table
kubectl get services Rust Compact table
kubectl logs <pod> Rust Dedup
kubectl <other> Passthrough No filtering

Missing global flags (priority)

All kubectl subcommands support these flags but RTK ignores them:

  • --context — multi-cluster (essential for devops)
  • --kubeconfig — custom config file
  • -n / --namespace — only on pods/services, not on other subcommands
  • -l / --selector — label selector
  • --as / --as-group — impersonation

Scope — TOML filters preferred

Command Description Approach Expected savings
kubectl get deployments Deployment list TOML — strip headers, compact table 60-70%
kubectl get nodes Node list TOML — strip headers, compact 60-70%
kubectl get configmaps ConfigMap list TOML — compact table 60-70%
kubectl get ingress Ingress list TOML — compact table 60-70%
kubectl get all All resources TOML — strip empty, compact 70-80%
kubectl describe pod Pod details TOML — strip events noise, keep status 70-80%
kubectl describe node Node details TOML — strip conditions/events noise 70-80%
kubectl apply -f Apply output TOML — short-circuit on "configured/created" 80-90%
kubectl top pods Resource usage TOML — compact table 50-60%
kubectl top nodes Node usage TOML — compact table 50-60%
kubectl rollout status Rollout status TOML — short-circuit on success 80%
kubectl exec Exec passthrough No filter needed 0%

Global flags (Rust change needed)

The KubectlCommands enum in main.rs needs a shared struct for global flags (--context, --kubeconfig, -n, -l, --as) forwarded to all subcommands. This is a Rust change in main.rs + container.rs.

Implementation priority

  1. Global flags (Rust) — --context, --kubeconfig, -n, -l on all subcommands
  2. TOML filterskubectl-describe.toml, kubectl-apply.toml, kubectl-rollout.toml
  3. Additional get resources — TOML for deployments, nodes, configmaps, ingress

References

  • Current implementation: src/container.rs (kubectl_pods, kubectl_services, kubectl_logs)
  • PR #426 (@jordi-murgo): global flags implementation (inactive, available for reference)
  • Rewrite rules: src/discover/rules.rs (kubectl already has rewrite)

Contributor guide