How to creates Kubernetes jobs with Python
![](https://www.pythian.com/hubfs/Imported_Blog_Media/Blog-Diagram.png)
In this blog post I will do a quick guide, with some code examples, on how to deploy a Kubernetes Job programmatically, using Python as the language of choice. For this I’m using GKE (Google Kubernetes Engine), logging via StackTrace and haveana image available on Google Container Registry. The architecture should be something like this:
![](https://www.pythian.com/hs-fs/hubfs/Imported_Blog_Media/Blog-Diagram.png?width=840&height=498&name=Blog-Diagram.png)
- A Dockerfile for my container
- A Python App that has the code to run (this will be the Job)
- Commit the code to the GCP Source Code Repositories
- A CloudBuild trigger (docs: https://cloud.google.com/cloud-build/docs/) that creates the container
- Create a trigger (can be a CronJob) that runs the code that deploys the Job.
- For this exercise, I’m going to trigger the Job creation from my own laptop.
- Job object
- Contains a metadata object
- Contains a job spec object
- Contains a pod template object
- Contains a pod template spec object
- Contains a container object
- Contains a pod template spec object
- Contains a pod template object
Share this
Previous story
← How to run RHEL5/Centos5 in Google Cloud
You May Also Like
These Related Stories
How to work around OMS 12.1.0.3 error: Metric evaluation error start – Get dynamic property error
How to work around OMS 12.1.0.3 error: Metric evaluation error start – Get dynamic property error
Sep 30, 2019
2
min read
Oracle E-Business Suite and 12cR1 database in Extended support - What to do?
![](https://www.pythian.com/hubfs/Imported_Blog_Media/mos_download_msg.png)
Oracle E-Business Suite and 12cR1 database in Extended support - What to do?
Oct 30, 2019
2
min read
Dockerized PMM in production
![](https://www.pythian.com/hubfs/Imported_Blog_Media/504782856.jpg)
Dockerized PMM in production
Mar 7, 2018
4
min read
No Comments Yet
Let us know what you think