Kuber k3s work with pods

Get all pods

kubectl get pods --all-namespaces

This will show you the pod’s name and its IP address.

kubectl get pod -o wide --all-namespaces

go into pod

kubectl exec --stdin --namespace stopphish --tty postgres-7fb65fb6b9-7rn55 -- /bin/bash

get all listen ports

lsof -i -P -n | grep LISTEN

Copy file from and to pods

kubectl cp <file-spec-src> <file-spec-dest>

POD in a specific container

kubectl cp <file-spec-src> <file-spec-dest>_ -c <specific-container>

Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace

kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar

Copy /tmp/foo from a remote pod to /tmp/bar locally

kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar