Skip to content

Commit 672af33

Browse files
committed
remove extra title kubectl cheatsheet
1 parent 6fa854c commit 672af33

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
@@ -206,8 +201,7 @@ kubectl get events --sort-by=.metadata.creationTimestamp
206201
kubectl diff -f ./my-manifest.yaml
207202
```
208203

209-
## Updating Resources
210-
204+
## Updating resources
211205

212206
```bash
213207
kubectl set image deployment/frontend www=image:v2 # Rolling update "www" containers of "frontend" deployment, updating the image
@@ -234,7 +228,7 @@ kubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq # Add an annota
234228
kubectl autoscale deployment foo --min=2 --max=10 # Auto scale a deployment "foo"
235229
```
236230

237-
## Patching Resources
231+
## Patching resources
238232

239233
```bash
240234
# Partially update a node
@@ -253,15 +247,16 @@ kubectl patch deployment valid-deployment --type json -p='[{"op": "remove", "
253247
kubectl patch sa default --type='json' -p='[{"op": "add", "path": "/secrets/1", "value": {"name": "whatever" } }]'
254248
```
255249

256-
## Editing Resources
250+
## Editing resources
251+
257252
Edit any API resource in your preferred editor.
258253

259254
```bash
260255
kubectl edit svc/docker-registry # Edit the service named docker-registry
261256
KUBE_EDITOR="nano" kubectl edit svc/docker-registry # Use an alternative editor
262257
```
263258

264-
## Scaling Resources
259+
## Scaling resources
265260

266261
```bash
267262
kubectl scale --replicas=3 rs/foo # Scale a replicaset named 'foo' to 3
@@ -270,7 +265,7 @@ kubectl scale --current-replicas=2 --replicas=3 deployment/mysql # If the deplo
270265
kubectl scale --replicas=5 rc/foo rc/bar rc/baz # Scale multiple replication controllers
271266
```
272267

273-
## Deleting Resources
268+
## Deleting resources
274269

275270
```bash
276271
kubectl delete -f ./pod.json # Delete a pod using the type and name specified in pod.json
@@ -306,7 +301,7 @@ kubectl exec my-pod -c my-container -- ls / # Run command in existing po
306301
kubectl top pod POD_NAME --containers # Show metrics for a given pod and its containers
307302
```
308303

309-
## Interacting with Nodes and Cluster
304+
## Interacting with Nodes and cluster
310305

311306
```bash
312307
kubectl cordon my-node # Mark my-node as unschedulable
@@ -386,17 +381,12 @@ Verbosity | Description
386381
`--v=8` | Display HTTP request contents.
387382
`--v=9` | Display HTTP request contents without truncation of contents.
388383

389-
390-
391384
## {{% heading "whatsnext" %}}
392385

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

396388
* See [kubectl](/docs/reference/kubectl/kubectl/) options.
397389

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

400392
* See more community [kubectl cheatsheets](https://github.com/dennyzhang/cheatsheet-kubernetes-A4).
401-
402-

0 commit comments

Comments
 (0)