jina.peapods.pods.k8slib.kubernetes_tools module

class jina.peapods.pods.k8slib.kubernetes_tools.K8SClients[source]

Bases: object

The Kubernetes api is wrapped into a class to have a lazy reading of the cluster configuration.

property k8s_client

Client for making requests to Kubernetes

Returns

k8s client

property v1

V1 client for core

Returns

v1 client

property beta

Beta client for using beta features

Returns

beta client

property networking_v1_beta1_api

Networking client used for creating the ingress

Returns

networking client

jina.peapods.pods.k8slib.kubernetes_tools.create(template, params, logger=<jina.logging.logger.JinaLogger object>, custom_resource_dir=None)[source]

Create a resource on Kubernetes based on the template. It fills the template using the params.

Parameters
  • template (str) – path to the template file.

  • custom_resource_dir (Optional[str]) – Path to a folder containing the kubernetes yml template files. Defaults to the standard location jina.resources if not specified.

  • logger (JinaLogger) – logger to use. Defaults to the default logger.

  • params (Dict) – dictionary for replacing the placeholders (keys) with the actual values.