Skip to content

Commit 689288a

Browse files
authored
Merge pull request #45607 from prashantrewar/update-kubectl-docs
Move the introduction page from SIG CLI guides to the kubectl reference
2 parents edaafa2 + f177728 commit 689288a

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: "Introduction To Kubectl"
3+
content_type: concept
4+
weight: 1
5+
---
6+
7+
Kubectl is the Kubernetes cli version of a swiss army knife, and can do many things.
8+
9+
While this Book is focused on using Kubectl to declaratively manage Applications in Kubernetes, it
10+
also covers other Kubectl functions.
11+
12+
## Command Families
13+
14+
Most Kubectl commands typically fall into one of a few categories:
15+
16+
| Type | Used For | Description |
17+
|----------------------------------------|----------------------------|----------------------------------------------------|
18+
| Declarative Resource Management | Deployment and Operations (e.g. GitOps) | Declaratively manage Kubernetes Workloads using Resource Config |
19+
| Imperative Resource Management | Development Only | Run commands to manage Kubernetes Workloads using Command Line arguments and flags |
20+
| Printing Workload State | Debugging | Print information about Workloads |
21+
| Interacting with Containers | Debugging | Exec, Attach, Cp, Logs |
22+
| Cluster Management | Cluster Ops | Drain and Cordon Nodes |
23+
24+
## Declarative Application Management
25+
26+
The preferred approach for managing Resources is through
27+
declarative files called Resource Config used with the Kubectl *Apply* command.
28+
This command reads a local (or remote) file structure and modifies cluster state to
29+
reflect the declared intent.
30+
31+
{{< alert color="success" title="Apply" >}}
32+
Apply is the preferred mechanism for managing Resources in a Kubernetes cluster.
33+
{{< /alert >}}
34+
35+
## Printing state about Workloads
36+
37+
Users will need to view Workload state.
38+
39+
- Printing summarize state and information about Resources
40+
- Printing complete state and information about Resources
41+
- Printing specific fields from Resources
42+
- Query Resources matching labels
43+
44+
## Debugging Workloads
45+
46+
Kubectl supports debugging by providing commands for:
47+
48+
- Printing Container logs
49+
- Printing cluster events
50+
- Exec or attaching to a Container
51+
- Copying files from Containers in the cluster to a user's filesystem
52+
53+
## Cluster Management
54+
55+
On occasion, users may need to perform operations to the Nodes of cluster. Kubectl supports
56+
commands to drain Workloads from a Node so that it can be decommission or debugged.
57+
58+
## Porcelain
59+
60+
Users may find using Resource Config overly verbose for *Development* and prefer to work with
61+
the cluster *imperatively* with a shell-like workflow. Kubectl offers porcelain commands for
62+
generating and modifying Resources.
63+
64+
- Generating + creating Resources such as Deployments, StatefulSets, Services, ConfigMaps, etc
65+
- Setting fields on Resources
66+
- Editing (live) Resources in a text editor
67+
68+
{{< alert color="warning" title="Porcelain For Dev Only" >}}
69+
Porcelain commands are time saving for experimenting with workloads in a dev cluster, but shouldn't
70+
be used for production.
71+
{{< /alert >}}

0 commit comments

Comments
 (0)