kubectl/docs/book
Benjamin Danon fe86de7a63 Fix the newName field name in the page
Kubernetes-commit: c39c64ffdaf677d09c412e7447b5bf400394068b
2020-03-29 00:23:47 +01:00
..
examples/nginx Re-add kubectl docs to kubectl staging 2019-06-25 16:28:04 -07:00
pages Fix the newName field name in the page 2020-03-29 00:23:47 +01:00
.gitignore Re-add kubectl docs to kubectl staging 2019-06-25 16:28:04 -07:00
CONTRIBUTING.md fix 1-12 number urls 2019-11-21 11:17:46 +08:00
Dockerfile Re-add kubectl docs to kubectl staging 2019-06-25 16:28:04 -07:00
README.md Re-add kubectl docs to kubectl staging 2019-06-25 16:28:04 -07:00
SUMMARY.md Add documentation around plugins 2020-02-26 14:50:50 +01:00
book.json Re-add kubectl docs to kubectl staging 2019-06-25 16:28:04 -07:00
favicon.ico Re-add kubectl docs to kubectl staging 2019-06-25 16:28:04 -07:00
firebase.json Re-add kubectl docs to kubectl staging 2019-06-25 16:28:04 -07:00
npm-shrinkwrap.json kubectl/docs/book: bump lodash from 4.17.5 to 4.17.13 2019-07-15 16:57:17 +05:30
package.json kubectl/docs/book: bump lodash from 4.17.5 to 4.17.13 2019-07-15 16:57:17 +05:30

README.md

{% panel style="success", title="Feedback and Contributing" %} Provide feedback on new kubectl docs at the survey

See CONTRIBUTING for instructions on filing/fixing issues and adding new content. {% endpanel %}

{% panel style="info", title="TL;DR" %}

  • Kubectl is the Kubernetes cli
  • Kubectl provides a swiss army knife of functionality for working with Kubernetes clusters
  • Kubectl may be used to deploy and manage applications on Kubernetes
  • Kubectl may be used for scripting and building higher-level frameworks {% endpanel %}

Kubectl

Kubectl is the Kubernetes cli version of a swiss army knife, and can do many things.

While this Book is focused on using Kubectl to declaratively manage Applications in Kubernetes, it also covers other Kubectl functions.

Command Families

Most Kubectl commands typically fall into one of a few categories:

Type Used For Description
Declarative Resource Management Deployment and Operations (e.g. GitOps) Declaratively manage Kubernetes Workloads using Resource Config
Imperative Resource Management Development Only Run commands to manage Kubernetes Workloads using Command Line arguments and flags
Printing Workload State Debugging Print information about Workloads
Interacting with Containers Debugging Exec, Attach, Cp, Logs
Cluster Management Cluster Ops Drain and Cordon Nodes

Declarative Application Management

The preferred approach for managing Resources is through declarative files called Resource Config used with the Kubectl Apply command. This command reads a local (or remote) file structure and modifies cluster state to reflect the declared intent.

{% panel style="info", title="Apply" %} Apply is the preferred mechanism for managing Resources in a Kubernetes cluster. {% endpanel %}

Printing state about Workloads

Users will need to view Workload state.

  • Printing summarize state and information about Resources
  • Printing complete state and information about Resources
  • Printing specific fields from Resources
  • Query Resources matching labels

Debugging Workloads

Kubectl supports debugging by providing commands for:

  • Printing Container logs
  • Printing cluster events
  • Exec or attaching to a Container
  • Copying files from Containers in the cluster to a user's filesystem

Cluster Management

On occasion, users may need to perform operations to the Nodes of cluster. Kubectl supports commands to drain Workloads from a Node so that it can be decommission or debugged.

Porcelain

Users may find using Resource Config overly verbose for Development and prefer to work with the cluster imperatively with a shell-like workflow. Kubectl offers porcelain commands for generating and modifying Resources.

  • Generating + creating Resources such as Deployments, StatefulSets, Services, ConfigMaps, etc
  • Setting fields on Resources
  • Editing (live) Resources in a text editor

{% panel style="danger", title="Porcelain For Dev Only" %} Porcelain commands are time saving for experimenting with workloads in a dev cluster, but shouldn't be used for production. {% endpanel %}