Tutorials:Run the example container on the cluster

From Collective Computational Unit
Revision as of 13:57, 18 June 2019 by Bastian.goldluecke (talk | contribs) (Set up a Kubernetes job script)
Jump to navigation Jump to search

Requirements

  • A working connection and login to the Kubernetes cluster.
  • A valid namespace selected with authorization to run pods.
  • A test container pushed to the CCU docker registry.


Set up a Kubernetes job script

Download the Kubernetes samples and look at job script in example_1. Alternatively, create your own directory and file named "job_script.yaml". Edit the contents as follows and replace all placeholders with your data:

When we start this job, it will create a single container based on the image we previously uploaded to the registry on a suitable node which serves the selected namespace of the cluster.

> kubectl apply -f job_script.yaml

Checking in on the container

We first check if our container is running.

> kubectl get pods
# somewhere in the output you should see a line like this:

Now that you now the name of the pod, you can check in on the logs:

# replace xxxx with the code from get pods.
> kubectl logs tf-mnist-xxxx

or get some more information about the node the pod was placed on etc.

# replace xxxx with the code from get pods.
> kubectl describe pod tf-mnist-xxxx