mirror of
https://github.com/namibia/awesome-cheatsheets.git
synced 2024-12-22 01:58:54 +00:00
added exec and set namespace commands
This commit is contained in:
parent
f8eb132e2f
commit
b35cf4043d
@ -23,6 +23,8 @@ kubectl config view -o jsonpath='{.users[?(@.name == "k8s")].user.password}'
|
||||
# Set credentials for foo.kuberntes.com
|
||||
kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword
|
||||
|
||||
# Set active namespace
|
||||
kubectl config set-context --current --namespace=namespace_name
|
||||
|
||||
##############################################################################
|
||||
# VIEWING, FINDING RESOURCES
|
||||
@ -115,3 +117,21 @@ kubectl logs pod_name
|
||||
|
||||
# Stream pod container logs (stdout, multi-container case)
|
||||
kubectl logs -f pod_name -c my-container
|
||||
|
||||
|
||||
##############################################################################
|
||||
# INTERACTING WITH RUNNING PODS
|
||||
##############################################################################
|
||||
|
||||
|
||||
# Run command in pod
|
||||
kubectl exec pod_name -- command_name
|
||||
|
||||
# Run command in pod with multiple containers
|
||||
kubectl exec pod_name -c container_name -- command_name
|
||||
|
||||
# Get terminal of pod
|
||||
kubectl exec -it pod_name /bin/sh
|
||||
|
||||
# Get terminal of a container running in pod with multiple containers
|
||||
kubectl exec -it pod_name -c container_name /bin/sh
|
||||
|
Loading…
Reference in New Issue
Block a user