Difference between revisions of "Tutorials:Run the example container on the cluster"
Jump to navigation
Jump to search
m (→Set up a Kubernetes job script) |
m (→Checking in on the container) |
||
| Line 26: | Line 26: | ||
> kubectl get pods | > kubectl get pods | ||
# somewhere in the output you should see a line like this: | # somewhere in the output you should see a line like this: | ||
| − | + | NAME READY STATUS RESTARTS AGE | |
| + | tf-mnist-xxxx 1/1 Running 0 7s | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 34: | Line 35: | ||
# replace xxxx with the code from get pods. | # replace xxxx with the code from get pods. | ||
> kubectl logs tf-mnist-xxxx | > kubectl logs tf-mnist-xxxx | ||
| + | # this should show the console output of your python program | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 14:21, 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:
NAME READY STATUS RESTARTS AGE
tf-mnist-xxxx 1/1 Running 0 7s
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
# this should show the console output of your python program
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