Kubernetes: Exec, port-forward, copy
4 Kubernetes commands: Exec, port-forward, copy. Click a command to see what each part does.
Kubernetes: Exec, port-forward, copyIndex
- Whole sheet137
- Basics: cluster, namespaces & resources17
- Get & list resources23
- Context & namespace3
- Find resources9
- Debug: describe, events, logs8
- Exec, port-forward, copy4
- Deploy, roll out, roll back, scale7
- Cleanup & nodes4
- Services, DNS & networking checks6
- Environment, config & secrets of workloads9
- Create, generate & apply YAML10
- Patch, label, annotate & scale9
- Delete & force delete6
- Nodes, scheduling & access control11
- Productivity: aliases, contexts & output11
Exec, port-forward, copy4
kubectl exec -it <pod> -n <namespace> -- shShell into a podWhat each part does
exec <pod>run a command in a container of the pod-itinteractive stdin + terminal--everything after this is the command, not kubectl flagsshthe shell (bash if available)
kubectl port-forward svc/<service> <local-port>:<service-port> -n <namespace>Reach a service from your laptopWhat each part does
port-forwardtunnel a local port into the clustersvc/<service>target a service (or pod/<pod>, deploy/<name>)<local-port>:<service-port>listen on localhost:<local-port>, forward to <service-port>
kubectl cp <namespace>/<pod>:<path> ./<file>Copy files out of / into a podWhat each part does
cpcopy files (needs tar inside the container)<namespace>/<pod>:<path>source in the pod; swap the arguments to copy into the pod
kubectl debug <pod> -it --image=busybox:1.36 --target=<container>Attach a debug container to a podWhat each part does
debug <pod>add an ephemeral debug container-itinteractive terminal--image=busybox:1.36image with the tools you need--target=<container>share that container's process namespace
Nothing matches.
My DevOps Playbook by Angelo John Calleja