Opening a shell in a k8s pod using kubectl on your local machine in [#kubernetes]

If you need a shell in a pod on a k3s/k8s cluster from your local machine without using Lens or k9s you can use this:

$ kubectl exec --stdin --tty pod-name -n namespace -- /bin/bash

Or use /bin/sh if the pod doesn’t have bash installed.

About Kubernetes