diff --git a/docs/user-guide/kubectl-cheatsheet.md b/docs/user-guide/kubectl-cheatsheet.md index c14e7c5c03..b2e1c51fa9 100644 --- a/docs/user-guide/kubectl-cheatsheet.md +++ b/docs/user-guide/kubectl-cheatsheet.md @@ -85,7 +85,7 @@ $ kubectl describe pods # Lists pods created by --output=json | jq -j '.spec.selector | to_entries | .[] | "\(.key)=\(.value),"') $ sel=${sel%?} # Remove trailing comma -$ pods=$(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name})` +$ pods=$(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name}) +$ echo $pods # Check which nodes are ready -$ kubectl get nodes -o jsonpath='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'| tr ';' "\n" | grep "Ready=True" +$ kubectl get nodes -o jsonpath='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'| tr ';' "\n" | grep "Ready=True" ``` ## Modifying and Deleting Resources @@ -122,6 +123,6 @@ $ kubectl run -i --tty busybox --image=busybox -- sh # Run pod as interacti $ kubectl attach -i # Attach to Running Container $ kubectl port-forward # Forward port of Pod to your local machine $ kubectl port-forward # Forward port to service -$ kubectl exec -- ls / # Run command in existing pod (1 container case) -$ kubectl exec -c -- ls / # Run command in existing pod (multi-container case) +$ kubectl exec -- ls / # Run command in existing pod (1 container case) +$ kubectl exec -c -- ls / # Run command in existing pod (multi-container case) ```