Kubernetes /Bin/Bash

Source URL: https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/

Language: shell

Created on: 2020-03-02 20:35:16

sudo kubectl -n <namespace> --context=<context-with-access> exec <pod-name> -it /bin/bash

sudo kubectl -n default --context=staging-devops exec microservice1-jd830k-880 -it /bin/bash
This page shows how to use kubectl exec to get a shell to a running container. Before you begin You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds: