Align cheatsheet comments (#16178)

Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>
This commit is contained in:
Ismail Alidzhikov
2019-09-27 23:29:36 +03:00
committed by Kubernetes Prow Robot
parent 61fd2ab61e
commit 5f9fe16f28
@@ -64,7 +64,7 @@ kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
kubectl config view -o jsonpath='{.users[*].name}' # get a list of users kubectl config view -o jsonpath='{.users[*].name}' # get a list of users
kubectl config get-contexts # display list of contexts kubectl config get-contexts # display list of contexts
kubectl config current-context # display the current-context kubectl config current-context # display the current-context
kubectl config use-context my-cluster-name # set the default context to my-cluster-name kubectl config use-context my-cluster-name # set the default context to my-cluster-name
# add a new cluster to your kubeconf that supports basic auth # add a new cluster to your kubeconf that supports basic auth
@@ -89,10 +89,10 @@ Kubernetes manifests can be defined in json or yaml. The file extension `.yaml`,
`.yml`, and `.json` can be used. `.yml`, and `.json` can be used.
```bash ```bash
kubectl apply -f ./my-manifest.yaml # create resource(s) kubectl apply -f ./my-manifest.yaml # create resource(s)
kubectl apply -f ./my1.yaml -f ./my2.yaml # create from multiple files kubectl apply -f ./my1.yaml -f ./my2.yaml # create from multiple files
kubectl apply -f ./dir # create resource(s) in all manifest files in dir kubectl apply -f ./dir # create resource(s) in all manifest files in dir
kubectl apply -f https://git.io/vPieo # create resource(s) from url kubectl apply -f https://git.io/vPieo # create resource(s) from url
kubectl create deployment nginx --image=nginx # start a single instance of nginx kubectl create deployment nginx --image=nginx # start a single instance of nginx
kubectl explain pods,svc # get the documentation for pod and svc manifests kubectl explain pods,svc # get the documentation for pod and svc manifests
@@ -153,7 +153,8 @@ kubectl get pod my-pod -o yaml --export # Get a pod's YAML without cluster
kubectl describe nodes my-node kubectl describe nodes my-node
kubectl describe pods my-pod kubectl describe pods my-pod
kubectl get services --sort-by=.metadata.name # List Services Sorted by Name # List Services Sorted by Name
kubectl get services --sort-by=.metadata.name
# List pods Sorted by Restart Count # List pods Sorted by Restart Count
kubectl get pods --sort-by='.status.containerStatuses[0].restartCount' kubectl get pods --sort-by='.status.containerStatuses[0].restartCount'
@@ -232,7 +233,8 @@ kubectl autoscale deployment foo --min=2 --max=10 # Auto scale a
## Patching Resources ## Patching Resources
```bash ```bash
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}' # Partially update a node # Partially update a node
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
# Update a container's image; spec.containers[*].name is required because it's a merge key # Update a container's image; spec.containers[*].name is required because it's a merge key
kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}' kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'