DEV Community

Eldad Assis
Eldad Assis

Posted on

5 2

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)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay