Home

Kubectl

Kubectl is the command-line interface for interacting with Kubernetes clusters. It is a core component of the Kubernetes project and the primary tool for administrators and developers to manage cluster resources. Kubectl communicates with the Kubernetes API server and uses a kubeconfig file to determine which cluster to talk to and how to authenticate. The default kubeconfig is typically located at ~/.kube/config and can contain multiple contexts, clusters, and user credentials.

Common operations include retrieving resource information with kubectl get, inspecting details with kubectl describe, and changing

Kubectl can manage resources across namespaces and switch contexts with kubectl config use-context. It provides a

Output formats are versatile, including JSON, YAML, and custom columns. Extensions and plugins are supported through

state
with
kubectl
apply,
create,
delete,
or
patch.
Kubectl
supports
imperative
commands
as
well
as
declarative
configuration
management
using
YAML
or
JSON.
With
kubectl
apply
-f,
users
declare
the
desired
state
of
resources
and
the
tool
reconciles
the
cluster
to
match
it.
Server-side
apply,
enabled
with
--server-side,
offers
improved
merging
behavior
for
concurrent
updates.
range
of
subcommands
for
day-to-day
operations,
such
as
rollout
(status,
undo,
restart),
scale
(for
deployments
and
other
controllers),
logs
and
attach
to
containers,
exec
to
run
commands
inside
a
pod,
port-forward
to
expose
services
locally,
and
proxy
to
the
API
server.
It
can
fetch
metrics
using
top,
assuming
a
metrics
server
is
available.
the
kubectl-
prefix
and
plugin
managers
like
Krew.
Overall,
kubectl
is
the
standard
interface
for
issuing
API
calls
to
Kubernetes
and
orchestrating
cluster
resources.