Running your container

Now, let's run the container we just made. We will use the kubectl run command to specify the simplest deployment—just the container:

kubectl run flask --image=quay.io/kubernetes-for-developers/flask:latest --port=5000 --save-configdeployment “flask” created

To see what this is doing, we need to ask the cluster for the current state of the resources we just created. When we use the kubectl run command, it will implicitly create a Deployment resource for us, and as you learned in the last chapter, a Deployment has a ReplicaSet within it, and a Pod within the ReplicaSet:

kubectl get deploymentsNAME      DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGEflask     1         1         1            1           20hkubectl get podsNAME                     READY     STATUS    RESTARTS   AGEflask-1599974757-b68pw ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.