From 3d346d3f1642cce54983c2f665a4d08cdf0df74c Mon Sep 17 00:00:00 2001 From: mike0sv Date: Fri, 16 Sep 2022 20:00:07 +0300 Subject: [PATCH] add kubernetes --- .../docs/extensions/deployment/kubernetes.md | 156 ++++++++++++++++++ content/docs/sidebar.json | 5 + 2 files changed, 161 insertions(+) create mode 100644 content/docs/extensions/deployment/kubernetes.md diff --git a/content/docs/extensions/deployment/kubernetes.md b/content/docs/extensions/deployment/kubernetes.md new file mode 100644 index 00000000..27bb2cd5 --- /dev/null +++ b/content/docs/extensions/deployment/kubernetes.md @@ -0,0 +1,156 @@ +# Kubernetes Deployments Support + +## Description + +**TODO** + +## Requirements + +```bash +pip install mlem[kubernetes] +# or +pip install kubernetes docker +``` + +## Examples + +```python + +``` + +## Implementation reference + +### `class K8sYamlBuilder` + +**MlemABC parent type**: `builder` + +**MlemABC type**: `kubernetes` + + MlemBuilder implementation for building Kubernetes manifests/yamls + +**Fields**: + +- `target: str` _(required)_ - Target path for the manifest/yaml + +- `namespace: str = "mlem"` - Namespace to create kubernetes resources such as + pods, service in + +- `image_name: str = "ml"` - Name of the docker image to be deployed + +- `image_uri: str = "ml:latest"` - URI of the docker image to be deployed + +- `image_pull_policy: ImagePullPolicy = "Always"` - Image pull policy for the + docker image to be deployed + +- `port: int = 8080` - Port where the service should be available + +- `service_type: ServiceType = NodePortService()` - Type of service by which + endpoints of the model are exposed + +--- + +### `class K8sDeploymentState` + +**MlemABC parent type**: `deploy_state` + +**MlemABC type**: `kubernetes` + + DeployState implementation for Kubernetes deployments + +**Fields**: + +- `model_hash: str` - hash of deployed model meta + +- `image: DockerImage` - Docker Image being used for Deployment + +- `deployment_name: str` - Name of Deployment + +--- + +### `class K8sDeployment` + +**MlemABC parent type**: `deployment` + +**MlemABC type**: `kubernetes` + + MlemDeployment implementation for Kubernetes deployments + +**Fields**: + +- `namespace: str = "mlem"` - Namespace to create kubernetes resources such as + pods, service in + +- `image_name: str = "ml"` - Name of the docker image to be deployed + +- `image_uri: str = "ml:latest"` - URI of the docker image to be deployed + +- `image_pull_policy: ImagePullPolicy = "Always"` - Image pull policy for the + docker image to be deployed + +- `port: int = 8080` - Port where the service should be available + +- `service_type: ServiceType = NodePortService()` - Type of service by which + endpoints of the model are exposed + +- `state_manager: StateManager` - State manager used + +- `server: Server` - Type of Server to use, with options such as FastAPI, + RabbitMQ etc. + +- `registry: DockerRegistry = DockerRegistry()` - Docker registry + +- `daemon: DockerDaemon = host=''` - Docker daemon + +- `kube_config_file_path: str` - Path for kube config file of the cluster + +--- + +### `class K8sEnv` + +**MlemABC parent type**: `env` + +**MlemABC type**: `kubernetes` + + MlemEnv implementation for Kubernetes Environments + +**Fields**: + +- `registry: DockerRegistry` - Docker registry + +--- + +### `class ClusterIPService` + +**MlemABC parent type**: `k8s_service_type` + +**MlemABC type**: `clusterip` + + ClusterIP Service implementation for service inside a Kubernetes + Cluster + +**No fields** + +--- + +### `class LoadBalancerService` + +**MlemABC parent type**: `k8s_service_type` + +**MlemABC type**: `loadbalancer` + + LoadBalancer Service implementation for service inside a Kubernetes + Cluster + +**No fields** + +--- + +### `class NodePortService` + +**MlemABC parent type**: `k8s_service_type` + +**MlemABC type**: `nodeport` + + NodePort Service implementation for service inside a Kubernetes Cluster + +**No fields** diff --git a/content/docs/sidebar.json b/content/docs/sidebar.json index 3eaba9ae..54eda082 100644 --- a/content/docs/sidebar.json +++ b/content/docs/sidebar.json @@ -243,6 +243,11 @@ "slug": "docker", "label": "Docker", "source": "deployment/docker.md" + }, + { + "slug": "kubernetes", + "label": "Kubernetes", + "source": "deployment/kubernetes.md" } ] },