How to run a container in Kubernetes without creating Deployment or Job?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
You do not need a Deployment or a Job just to run one container in Kubernetes. If the goal is an ad hoc test, a debugging shell, or a single long-running process with no controller, a plain Pod is the simplest answer.
Use kubectl run for a Quick Pod
The fastest path is kubectl run, which creates a Pod from an image. For a simple web server:
That creates a single Pod named demo-nginx. The --restart=Never flag matters because it makes the intent explicit: create a Pod, not a higher-level controller.
Check the result with:
For interactive debugging, attach a shell immediately:
This pattern is useful when you want to test DNS resolution, curl an internal service, or inspect mounted files from inside the cluster.
Use a Pod Manifest When You Want Repeatability
kubectl run is convenient, but a Pod manifest is easier to review, reapply, and commit to version control. A minimal example looks like this:
Create it with:
This is still "just a Pod." There is no Deployment managing replicas and no Job managing completion state. Kubernetes schedules the Pod, starts the container, and then stops there.
When a Plain Pod Is the Right Tool
Using a Pod directly makes sense when:
- You are testing an image quickly
- You need a temporary shell inside the cluster
- You want to reproduce an issue with the fewest moving parts
- You have a one-off process and you are managing cleanup yourself
It is also a good choice when you want to understand the raw Pod spec before adding controllers on top.
For example, if you only need to inspect environment variables or mounted volumes, a Pod is often easier to reason about than a Deployment because there is only one object in play.
Observe, Debug, and Remove the Pod
Once the container is running, normal kubectl commands still apply:
If the image exits immediately, inspect its status:
That will show whether the container completed successfully, crashed, or failed to pull the image.
You can also preview the Pod definition that kubectl run would generate:
That is a practical way to move from a one-liner command to a reusable manifest.
Know the Tradeoff: No Controller Means No Safety Net
A plain Pod is intentionally bare-bones. If the Pod is deleted, it stays deleted. If the node disappears, Kubernetes does not recreate it somewhere else unless a controller owns it.
That is the biggest tradeoff compared with a Deployment or Job:
- No rollout history
- No replica management
- No automatic recreation after deletion
- No completion tracking beyond the Pod's own status
So a Pod is excellent for experiments and targeted operational work, but it is usually not the right long-term shape for production services.
Common Pitfalls
- Assuming a standalone Pod will be recreated automatically after failure or deletion.
- Forgetting
--restart=Neverand ending up with behavior you did not intend. - Using a plain Pod for batch work that really needs retry and completion semantics, which is what a Job is for.
- Expecting a Pod to provide scaling or rolling updates, which are Deployment responsibilities.
- Leaving debug Pods running after you are done, which creates clutter and sometimes cost.
Summary
- You can run a container in Kubernetes without a Deployment or Job by creating a plain Pod.
- '
kubectl run ... --restart=Neveris the quickest way to do it from the command line.' - A Pod manifest is better when you want repeatability and reviewable configuration.
- Standalone Pods are good for testing, debugging, and one-off tasks.
- The tradeoff is that no controller is watching or recreating the Pod for you.

