liveBook · Manning

Kubectl

As explained in Kubernetes in Action, Second Edition

kubectl is the Kubernetes command-line client for submitting requests to and managing resources through the Kubernetes API.

kubectl is the Kubernetes command-line client. It sends requests to the Kubernetes API server, which validates and stores resource objects and triggers control-plane components to act on them. section 1.2.4 section 3.2

Prepare kubectl and use it to inspect a cluster:

  • Install the executable, place it on your path, and configure kubeconfig so it knows which cluster to contact. section 3.2.1
  • Check connectivity with kubectl cluster-info; list resources with kubectl get; inspect detailed status with kubectl describe. section 3.2.3
  • Speed up repeated work with the k alias and shell tab completion, including completion for object names. section 3.2.1

Inspecting a cluster

Run kubectl cluster-info to confirm that the API server responds, kubectl get nodes to list nodes, and kubectl describe node NAME to view status, resource usage, system information, and running containers. Deployments can also be created, exposed, and scaled with kubectl commands. section 3.2.3 section 3.4

Figure 3.6 Interacting with a Kubernetes cluster
figure

Visualizes kubectl communicating with the Kubernetes API server and the control plane responding to submitted changes. section 3.2

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains installation, kubeconfig, aliases, completion, connectivity, listing, and inspection, while deferring the many other commands.
Examples
Demonstrates cluster-info, get nodes, describe node, deployment creation, service exposure, scaling, logs, file copying, and command execution.
What it assumes
Assumes access to a Kubernetes cluster and teaches installation, kubeconfig preparation, and basic API interaction from the beginning.
What you can do after
Operate/configure Kubernetes by installing kubectl, connecting through kubeconfig, deploying applications, scaling workloads, and inspecting resources.
How it connects
Connects kubectl with the Kubernetes API server, kubeconfig, Kubernetes objects, Deployments, Services, Pods, Nodes, and controllers.

Also explained in

Compare how 11 books explain kubectl →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.