A Quick Way to Run Pods
Learn to create Pods using the imperative method.
Creating a Pod with Mongo
Just as we can execute docker run
to create containers, kubectl
allows us to create Pods with a single command.
For example, if we’d like to create a Pod with a Mongo database, the command is as follows:
Press + to interact
kubectl run db --image mongo
You’ll notice that the output says that “pod/db created”. We have created our first Pod. We can confirm that by listing all the Pods in the cluster.
Press + to interact
kubectl get pods
The output should be something like this:
Press + to interact
NAME READY STATUS RESTARTS AGEdb 0/1 ContainerCreating 0 1m
In the output, we can see the following:
- The name of the Pod
- Its readiness