Merge pull request #25286 from keshy/patch-1

Updated Cheat sheet to include additional command to get shell access to a running pod
This commit is contained in:
Kubernetes Prow Robot 2020-12-04 14:43:25 -08:00 committed by GitHub
commit 3b8399c7b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -311,6 +311,7 @@ kubectl run nginx --image=nginx # Run pod nginx and write it
kubectl attach my-pod -i # Attach to Running Container
kubectl port-forward my-pod 5000:6000 # Listen on port 5000 on the local machine and forward to port 6000 on my-pod
kubectl exec my-pod -- ls / # Run command in existing pod (1 container case)
kubectl exec --stdin --tty my-pod -- /bin/sh # Interactive shell access to a running pod (1 container case)
kubectl exec my-pod -c my-container -- ls / # Run command in existing pod (multi-container case)
kubectl top pod POD_NAME --containers # Show metrics for a given pod and its containers
```