Build BentoML Services into Images on K8S
Project description
bentobuild
A helper which provides a simple api to launching pods to create docker images from BentoML Services in a Kubernetes clister, by making use of BentoMLs YataiService.
This does not use the bentoml containerize
command because it requires Docker daemon and build containers most commonly wont have a running a docker daemon. Instead, this package creates a custom Kubernetes Job, which uses bentoml retrieve
alongside Kaniko executor
to build the BentoML context and artifacts into a docker image and push it to your desired docker image and tag.
The resulting image can be served via KFServing inferenceservice or via the bundled serving experiment.
The builder schedules a standard Kubernetes Job with several containers to build the image.
YataiService Required
This project really only makes sense when using BentoML with a YataiService
, as multiple pods will need to access the model storage backend.
I would suggest running the YataiService
so it is only open to local cluster traffic, and refer to it via its cluster.local
domain name.
Builder
In the example below, the builder will create a new Kubernetes Job, which will produce an image, tag it and push it the registry.
from bentobuild.job import BentoJobBuilder
builder = bentobuild.BentoJobBuilder()
# safe_build requires a BentoML Service ID, an image tag and your build namespace.
# This is the namespace where your docker credentials need to exist - see below.
builder.safe_build('FastaiDemo:20201105133154_04F821', 'iancoffey/mydemo:latest', 'test1')
# resources begin running
builder.status() # prints some output from the Job status
Installation
pip install bentobuild
Docker Credentials
It is important to configure Docker credentials for the builder to use to push to your desired repo.
To do this, the project supports mounting a configmap containting a Docker config.json
into the build environment.
See the Kaniko documentation for more info on how to format and create this secret.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bentobuild-0.0.5.tar.gz
.
File metadata
- Download URL: bentobuild-0.0.5.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1b89330ed937e374e33d5d44eec3cac18338c1b6b63753db2b7aaa7ba908fdf |
|
MD5 | af824a84ed2579b471220c6dbeaef931 |
|
BLAKE2b-256 | f4af19ad8b7449a93bc3402c13c7e9834c6c74a7dabdf89040ec5a197857b844 |
File details
Details for the file bentobuild-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: bentobuild-0.0.5-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0850c9283b7cc54a7eaa29c8a560ccc70d1b0b3cff6c59c2cd2ca7dc9c596ee |
|
MD5 | 135d95e27d08b7cfcbb21fb3de4e0228 |
|
BLAKE2b-256 | 6c0106c04f172498a9aec94013ea968624962e0472a6ad944887f9b4db9856b9 |