Running a Debian Pod on Kubernetes with kubectl

Krzysztof
Flow Lab
Published in
2 min readFeb 18, 2023

--

Whether you need to troubleshoot or test your applications inside Google Kubernetes Engine GKE, run kubectl run a command with the provided options

kubectl run flow-pod -i --tty --image debian:bullseye --restart=Never -- bash

where:

  • kubectl run: This is the primary command to create a new pod or deployment in a Kubernetes cluster.
  • -i: This option runs the container in interactive mode, allowing you to send input and receive output from the container.
  • --tty: This option allocates a TTY (TeleTYpewriter) terminal for the container, which enables you to enter commands and see their output, just as if you were working on a local terminal.
  • --image debian:bullseye: This option specifies the Docker image used for the pod. In this case, the image is set to debian:bullseyethe latest stable Debian 11 "Bullseye" image available in the Docker registry.
  • --restart=Never: This option sets the restart policy for the pod, which means that the pod will not be restarted if the container exits for any reason. This is useful for running one-off commands or interactive shells in containers.
  • -- bash: This option specifies the shell to be run inside the container. In this case, the command is set to start a bash shell inside the container when the pod is created. Once the pod is created, you can interact with the shell as if working on a local terminal.

So, this kubectl run the command creates a pod named, based on the debian:bullseye image, with a single container running a bash shell allowing interaction with the container. The pod has a restart policy, which will terminate if the container exits. Once the pod is created, you will have an interactive terminal that you can use to run commands, install software, or perform other tasks inside the container.

--

--