DEV Community

Eldad Assis
Eldad Assis

Posted on

Open a command prompt in a Kubernetes cluster

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.

Top comments (0)