Kubernetes

Service

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

  1. Check that you cluster is working

    kubectl get nodes
    
  2. Start a container image. We use nginx as an example

    kubectl run --generator=run-pod/v1 nginx --image nginx
    

    If you have use docker run before 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.

  3. Check that your pod has started up and is running

    kubectl get pods
    
  4. Check the details of your pod by doing

     kubectl describe pod/nginx
    
  5. 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.

More information

In this section we requested Kubernetes to run an nginx image. Kubernetes did the following (simplifed):

  1. Fetched the image from DockerHub, based on the name. i.e. https://hub.docker.com/nginx

  2. Created a container with the image

  3. Created a pod and placed the container inside it

  4. 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: