In this section, you will learn to run a web server (nginx) using Kubernetes.
To being, you should already have a working cluster from previous steps
Check that you cluster is working
kubectl get nodes
Start a container image. We use nginx as an example
kubectl run --generator=run-pod/v1 nginx --image nginx
If you have use
docker runbefore this command should look familiar. This starts a pod with a nginx image. We go into detail what is a pod at the end of this section.
Check that your pod has started up and is running
kubectl get pods
Check the details of your pod by doing
kubectl describe pod/nginx
Now that you have a pod working, we need a way of getting to it from the Internet. We will cover this in the next section.
In this section we requested Kubernetes to run an
nginx image. Kubernetes did
the following (simplifed):
Fetched the image from DockerHub, based on the name. i.e. https://hub.docker.com/nginx
Created a container with the image
Created a pod and placed the container inside it
Scheduled the pod to a free node
On Kubernetes, the smallest runnable unit is a pod, which holds one (or more) containers.
For more information, refer to: