Skip to content

Commit 8c60bd2

Browse files
authored
Merge pull request #22975 from kbhawkey/kb-fix-heading-cheatsheet
remove extra title in kubectl cheatsheet
2 parents aeff475 + 672af33 commit 8c60bd2

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

content/en/docs/reference/kubectl/cheatsheet.md

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,11 @@ card:
1212

1313
<!-- overview -->
1414

15-
See also: [Kubectl Overview](/docs/reference/kubectl/overview/) and [JsonPath Guide](/docs/reference/kubectl/jsonpath).
16-
17-
This page is an overview of the `kubectl` command.
18-
19-
15+
This page contains a list of commonly used `kubectl` commands and flags.
2016

2117
<!-- body -->
2218

23-
# kubectl - Cheat Sheet
24-
25-
## Kubectl Autocomplete
19+
## Kubectl autocomplete
2620

2721
### BASH
2822

@@ -31,7 +25,7 @@ source <(kubectl completion bash) # setup autocomplete in bash into the current
3125
echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell.
3226
```
3327

34-
You can also use a shorthand alias for `kubectl` that also works with completion:
28+
You can also use a shorthand alias for `kubectl` that also works with completion:
3529

3630
```bash
3731
alias k=kubectl
@@ -45,7 +39,7 @@ source <(kubectl completion zsh) # setup autocomplete in zsh into the current s
4539
echo "[[ $commands[kubectl] ]] && source <(kubectl completion zsh)" >> ~/.zshrc # add autocomplete permanently to your zsh shell
4640
```
4741

48-
## Kubectl Context and Configuration
42+
## Kubectl context and configuration
4943

5044
Set which Kubernetes cluster `kubectl` communicates with and modifies configuration
5145
information. See [Authenticating Across Clusters with kubeconfig](/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) documentation for
@@ -77,14 +71,15 @@ kubectl config set-context --current --namespace=ggckad-s2
7771
# set a context utilizing a specific username and namespace.
7872
kubectl config set-context gce --user=cluster-admin --namespace=foo \
7973
&& kubectl config use-context gce
80-
74+
8175
kubectl config unset users.foo # delete user foo
8276
```
8377

84-
## Apply
78+
## Kubectl apply
79+
8580
`apply` manages applications through files defining Kubernetes resources. It creates and updates resources in a cluster through running `kubectl apply`. This is the recommended way of managing Kubernetes applications on production. See [Kubectl Book](https://kubectl.docs.kubernetes.io).
8681

87-
## Creating Objects
82+
## Creating objects
8883

8984
Kubernetes manifests can be defined in YAML or JSON. The file extension `.yaml`,
9085
`.yml`, and `.json` can be used.
@@ -138,7 +133,7 @@ EOF
138133

139134
```
140135

141-
## Viewing, Finding Resources
136+
## Viewing, finding resources
142137

143138
```bash
144139
# Get commands with basic output
@@ -213,8 +208,7 @@ kubectl get nodes -o json | jq -c 'path(..)|[.[]|tostring]|join(".")'
213208
kubectl get pods -o json | jq -c 'path(..)|[.[]|tostring]|join(".")'
214209
```
215210

216-
## Updating Resources
217-
211+
## Updating resources
218212

219213
```bash
220214
kubectl set image deployment/frontend www=image:v2 # Rolling update "www" containers of "frontend" deployment, updating the image
@@ -241,7 +235,7 @@ kubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq # Add an annota
241235
kubectl autoscale deployment foo --min=2 --max=10 # Auto scale a deployment "foo"
242236
```
243237

244-
## Patching Resources
238+
## Patching resources
245239

246240
```bash
247241
# Partially update a node
@@ -260,15 +254,16 @@ kubectl patch deployment valid-deployment --type json -p='[{"op": "remove", "
260254
kubectl patch sa default --type='json' -p='[{"op": "add", "path": "/secrets/1", "value": {"name": "whatever" } }]'
261255
```
262256

263-
## Editing Resources
257+
## Editing resources
258+
264259
Edit any API resource in your preferred editor.
265260

266261
```bash
267262
kubectl edit svc/docker-registry # Edit the service named docker-registry
268263
KUBE_EDITOR="nano" kubectl edit svc/docker-registry # Use an alternative editor
269264
```
270265

271-
## Scaling Resources
266+
## Scaling resources
272267

273268
```bash
274269
kubectl scale --replicas=3 rs/foo # Scale a replicaset named 'foo' to 3
@@ -277,7 +272,7 @@ kubectl scale --current-replicas=2 --replicas=3 deployment/mysql # If the deplo
277272
kubectl scale --replicas=5 rc/foo rc/bar rc/baz # Scale multiple replication controllers
278273
```
279274

280-
## Deleting Resources
275+
## Deleting resources
281276

282277
```bash
283278
kubectl delete -f ./pod.json # Delete a pod using the type and name specified in pod.json
@@ -313,7 +308,7 @@ kubectl exec my-pod -c my-container -- ls / # Run command in existing po
313308
kubectl top pod POD_NAME --containers # Show metrics for a given pod and its containers
314309
```
315310

316-
## Interacting with Nodes and Cluster
311+
## Interacting with Nodes and cluster
317312

318313
```bash
319314
kubectl cordon my-node # Mark my-node as unschedulable
@@ -393,17 +388,12 @@ Verbosity | Description
393388
`--v=8` | Display HTTP request contents.
394389
`--v=9` | Display HTTP request contents without truncation of contents.
395390

396-
397-
398391
## {{% heading "whatsnext" %}}
399392

400-
401-
* Learn more about [Overview of kubectl](/docs/reference/kubectl/overview/).
393+
* Read the [kubectl overview](/docs/reference/kubectl/overview/) and learn about [JsonPath](/docs/reference/kubectl/jsonpath).
402394

403395
* See [kubectl](/docs/reference/kubectl/kubectl/) options.
404396

405-
* Also [kubectl Usage Conventions](/docs/reference/kubectl/conventions/) to understand how to use it in reusable scripts.
397+
* Also read [kubectl Usage Conventions](/docs/reference/kubectl/conventions/) to understand how to use kubectl in reusable scripts.
406398

407399
* See more community [kubectl cheatsheets](https://github.com/dennyzhang/cheatsheet-kubernetes-A4).
408-
409-

0 commit comments

Comments
 (0)