Open a command prompt in a Kubernetes cluster

eldadak profile image Eldad Assis ・1 min read

For cases where I need to open a command prompt in a running container in my Kubernetes cluster, I simply run the following

# Ubuntu
kubectl run my-ubuntu --rm -i -t --image ubuntu:18.04 -- bash

# CentOS
kubectl run my-centos --rm -i -t --image centos:8 -- bash

# Alpine
kubectl run my-alpine --rm -i -t --image alpine:3.10 -- sh

This starts up a pod (in the default namespace by default) and opens a command line in the given container.
As I'm running as root, I can install anything I need for debugging and testing right in my cluster.


markdown guide