talira

The Kubernetes command-line tool

open sourceApache-2.0self-hostablefree

kubectl is the command-line tool for talking to a Kubernetes cluster's control plane through the Kubernetes API. It creates, applies, diffs, inspects and deletes resources from files or stdin, reads logs, runs commands in containers, copies files, port-forwards and attaches to running containers, and builds manifests with Kustomize (kubectl apply -k). It reads clusters and credentials from kubeconfig files (~/.kube/config, KUBECONFIG or --kubeconfig) and is extended with plugins: any executable named kubectl-<name> on the PATH becomes kubectl <name>, and the Krew plugin manager installs them. It's developed by Kubernetes SIG CLI in the main Kubernetes repository, under Apache-2.0, for Linux, macOS and Windows.

Ways to install

Package managers

Problems it solves

  • deploy my YAML manifests to a Kubernetes cluster from the terminal
  • see why a pod keeps crashing and read its logs
  • open a shell inside a running container to debug it
  • reach a service inside the cluster from my laptop without exposing it
  • show what would change on the cluster before applying a manifest
  • switch between several clusters and credentials from one machine
  • script deployments and rollbacks in CI against the Kubernetes API
  • copy a file out of a running container
  • get resource details as JSON or YAML for scripts to parse
  • add my own subcommands to the Kubernetes command line

Features

  • apply, create, get, describe, edit and delete resources
  • kubectl diff before applying
  • logs, exec, attach, cp and port-forward
  • rollout status, history and undo
  • built-in Kustomize (apply -k and kubectl kustomize)
  • kubeconfig contexts for several clusters
  • JSON, YAML, JSONPath and custom-column output
  • plugins as kubectl-* executables, installable with Krew

Capabilities

Has a command line toolplan not known
Takes pluginsplan not known

Alternatives

The same job

These do what kubectl does.

  1. K9s Kubernetes CLI to manage your clusters in style
  2. Headlamp An easy-to-use and extensible Kubernetes web UI
  3. Lens The IDE for everything but code
  4. MCP Server Kubernetes MCP server that lets AI assistants manage a Kubernetes cluster through kubectl and Helm

Compare kubectl with the top 3