0

I want to schedule three sequential tasks using Kubernetes. these three tasks are:

1- download a file from a URL

2- process the file

3- Put the file in a web server (The server must be configured and some modules must be installed on it first)

I think I can do this using Kubernetes jobs, but I did not find an example of doing such tasks.

In Addition, I do not know how to first configure the web server before using it. Is it possible to create a Docker image from the server, configure it and finally get a snapshot from it?

EDIT: As the first step, I just want to create a job for downloading a file. I could not find any sample for that; how can I do that?

sajad
  • 2,094
  • 11
  • 32
  • 52
  • Possible duplicate of [How to run containers sequentially as a Kubernetes job?](https://stackoverflow.com/questions/40713573/how-to-run-containers-sequentially-as-a-kubernetes-job) – Vasili Angapov May 10 '19 at 15:14
  • @VasilyAngapov: I saw that topic but my goal is two parts: I do not know is it possible to use configured docker images in Kubernetes yaml files; and I do not know what is the best practice for my scenarion, e.g. using pods, jobs, docker images how must be used. – sajad May 10 '19 at 15:52
  • Kubernetes does not have builtin logic for sequential jobs. The most voted answer from the link I gave with initContainers is I believe the best possible way. It's a bit hacky and dirty but it will work. – Vasili Angapov May 10 '19 at 16:05
  • Job queues like RabbitMQ also fit well in this space. (Run RabbitMQ in a StatefulSet with a PersistentVolumeClaim, and run workers via a scalable Deployment, and don't use Jobs at all.) – David Maze May 10 '19 at 16:59

1 Answers1

1

For my opinion the most efficient and great solution nowadays is still use initContainers.

InitContainers is the best tool to handle your task in current situation. Use example provided here and implement all your tasks as initContainers.

About configuring web-server and further container usage: There are a lot of articles that provide step-by-step instruction on how to create own Docker image. I can recommend you use as an example Steps To Build Apache Web Server Docker Image article.

Vit
  • 7,740
  • 15
  • 40