Skip to content

Instantly share code, notes, and snippets.

@ItsCosmas
Last active January 15, 2025 06:42
Show Gist options
  • Save ItsCosmas/8819b0100d11306185da6d5fbfca1cd4 to your computer and use it in GitHub Desktop.
Save ItsCosmas/8819b0100d11306185da6d5fbfca1cd4 to your computer and use it in GitHub Desktop.
kubectl exec
kubectl config get-contexts
kubectl config use-context <context-name>
kubectl get namespaces
kubectl get pods -n <namespace>
kubectl exec -i -t -n <namespace-name> <pod-name> -c web -- sh -c "clear; (bash || ash || sh)"
kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{"\n"}{.metadata.name}{":\t"}{range .spec.containers[*]}{.image}{", "}{end}{end}' |\
sort
@ItsCosmas
Copy link
Author

Execute into a kubernetes pod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment