Cloud Native 8 min read

Boost Your Kubernetes Workflow: 6 Essential Open‑Source Tools and Tips

This guide introduces six practical open‑source Kubernetes utilities—including kubectl autocomplete, go‑template output customization, interactive clients, alias generators, manifest validators, and Kedge simplifiers—to help users improve cluster reliability, streamline command‑line interactions, and reduce the complexity of manifest files.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
Boost Your Kubernetes Workflow: 6 Essential Open‑Source Tools and Tips

kubectl autocomplete

Enable command‑line completion for kubectl in Bash or Zsh.

Bash

echo "source <(kubectl completion bash)" >> ~/.bashrc
source ~/.bashrc

If completion does not work, install the bash-completion package and reload the shell.

Zsh

echo "source <(kubectl completion zsh)" >> ~/.zshrc
source ~/.zshrc

Customizing kubectl get output

Use the Go go-template engine to extract specific fields or format columns.

Extract a single field (UID of all pods)

kubectl get pods --all-namespaces -o go-template='{{range .items}}{{.metadata.uid}}
{{end}}'

Formatted table with printf

kubectl get pods --all-namespaces -o go-template='{{range .items}}{{printf "|%-20s|%-50s|%-30s|
" .metadata.namespace .metadata.name .metadata.uid}}{{end}}'

Nested range – list all container images used by pods

kubectl get pods --all-namespaces -o go-template='{{range .items}}{{range .spec.containers}}{{printf "%s
" .image}}{{end}}{{end}}'

Conditional filtering – unschedulable nodes with IP

kubectl get nodes -o go-template='{{range .items}}{{if .spec.unschedulable}}{{.metadata.name}} {{.spec.externalID}}
{{end}}{{end}}'

Comma‑separated custom columns

kubectl -n kube-system get pods coredns-64b597b598-7547d \
  -o custom-columns=NAME:.metadata.name,HOSTIP:.status.hostIP

Template file with go-template-file

# test.tmpl
NAME    HOSTIP
metadata.name    status.hostIP

kubectl -n kube-system get pods coredns-64b597b598-7547d \
  -o custom-columns-file=test.tmpl

Interactive Kubernetes client

Kube‑prompt provides an interactive shell that auto‑fills kubectl commands and shows contextual help, removing the need to type the kubectl prefix manually.

Generating kubectl aliases

The open‑source project kubectl‑aliases can generate convenient shortcuts.

kd → kubectl describe
kgdepallw → kubectl get deployment --all-namespaces --watch

Validating manifest files

Kubeval validates Kubernetes YAML or JSON files against the schemas of multiple Kubernetes versions.

kubeval nginx.yaml
# Example output when a field is invalid
The document nginx.yaml contains an invalid Deployment
---> spec.replicas: Invalid type. Expected: integer, given: string

Simplifying manifest definitions with Kedge

Kedge offers a concise DSL that compiles to standard Kubernetes manifests, reducing boilerplate.

Example Kedge file (simplified):

service:
  name: myapp
  ports:
    - port: 80
      targetPort: 8080

deployment:
  name: myapp
  replicas: 3
  containers:
    - name: myapp
      image: myrepo/myapp:1.0
      ports:
        - containerPort: 8080

Running kedge convert -f myapp.kedge produces the equivalent standard Kubernetes Service and Deployment manifests.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud NativeKuberneteskubectlCLI toolsgo-templatemanifest validation
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.