Tutorials:Run the example container on the cluster: Difference between revisions

From Collective Computational Unit
Jump to navigation Jump to search
Created page with "== 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 C..."
 
Line 8: Line 8:
== Set up a Kubernetes job script ==
== Set up a Kubernetes job script ==


Download the [File:Kubernetes samples|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:
Download the [[File:Kubernetes samples|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:


<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
Line 18: Line 18:
> kubectl apply -f job_script.yaml
> kubectl apply -f job_script.yaml
</syntaxhighlight>
</syntaxhighlight>


== Checking in on the container ==
== Checking in on the container ==

Revision as of 13:57, 18 June 2019

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