Start Kubernetes job with http request

4/3/2019

What is most simple way to start Kubernetes job with the http request (webhook)? I need to build docker image after push to github and have to do it inside cluster.

-- Jonas
kubernetes
webhooks

1 Answer

4/3/2019

I think you are looking for KNative. Mainly the Build part of it.

KNative is still on early stages, but is pretty much what you need. If the build features does not attend your needs, you can still use the other features like Serving to trigger the container image from http calls and run the tools you need.

Here is the description from the Build Docs:

A Knative Build extends Kubernetes and utilizes existing Kubernetes primitives to provide you with the ability to run on-cluster container builds from source. For example, you can write a build that uses Kubernetes-native resources to obtain your source code from a repository, build a container image, then run that image.

While Knative builds are optimized for building, testing, and deploying source code, you are still responsible for developing the corresponding components that:

  • Retrieve source code from repositories.
  • Run multiple sequential jobs against a shared filesystem, for example:
    • Install dependencies.
    • Run unit and integration tests.
  • Build container images.
  • Push container images to an image registry, or deploy them to a cluster.

The goal of a Knative build is to provide a standard, portable, reusable, and performance optimized method for defining and running on-cluster container image builds. By providing the “boring but difficult” task of running builds on Kubernetes, Knative saves you from having to independently develop and reproduce these common Kubernetes-based development processes.

-- Diego Mendes
Source: StackOverflow