jina.orchestrate.deployments.config.k8slib.kubernetes_deployment module#

jina.orchestrate.deployments.config.k8slib.kubernetes_deployment.get_deployment_yamls(name, namespace, image_name, container_cmd, container_args, replicas, pull_policy, jina_deployment_name, pod_type, shard_id=None, port=None, env=None, gpus=None, image_name_uses_before=None, image_name_uses_after=None, container_cmd_uses_before=None, container_cmd_uses_after=None, container_args_uses_before=None, container_args_uses_after=None, monitoring=False, port_monitoring=None, protocol=None)[source]#

Get the yaml description of a service on Kubernetes

  • name (str) – name of the service and deployment

  • namespace (str) – k8s namespace of the service and deployment

  • image_name (str) – image for the k8s deployment

  • container_cmd (str) – command executed on the k8s pods

  • container_args (str) – arguments used for the k8s pod

  • replicas (int) – number of replicas

  • pull_policy (str) – pull policy used for fetching the Docker images from the registry.

  • jina_deployment_name (str) – Name of the Jina Deployment this deployment belongs to

  • pod_type (str) – type os this pod, can be gateway/head/worker

  • shard_id (Optional[int]) – id of this shard, None if shards=1 or this is gateway/head

  • port (Optional[int]) – port which will be exposed by the deployed containers

  • env (Optional[Dict]) – environment variables to be passed into configmap.

  • gpus (Union[int, str, None]) – number of gpus to use, for k8s requires you pass an int number, refers to the number of requested gpus.

  • image_name_uses_before (Optional[str]) – image for uses_before container in the k8s deployment

  • image_name_uses_after (Optional[str]) – image for uses_after container in the k8s deployment

  • container_cmd_uses_before (Optional[str]) – command executed in the uses_before container on the k8s pods

  • container_cmd_uses_after (Optional[str]) – command executed in the uses_after container on the k8s pods

  • container_args_uses_before (Optional[str]) – arguments used for uses_before container on the k8s pod

  • container_args_uses_after (Optional[str]) – arguments used for uses_after container on the k8s pod

  • monitoring (bool) – enable monitoring on the deployment

  • port_monitoring (Optional[int]) – port which will be exposed, for the prometheus server, by the deployed containers

  • protocol (Optional[str]) – In case of being a Gateway, the protocol used to expose its server

Return type:



Return a dictionary with all the yaml configuration needed for a deployment

jina.orchestrate.deployments.config.k8slib.kubernetes_deployment.get_cli_params(arguments, skip_list=(), port=None)[source]#

Get cli parameters based on the arguments.

  • arguments (Namespace) – arguments where the cli parameters are generated from

  • skip_list (Tuple[str]) – list of arguments which should be ignored

  • port (Optional[int]) – overwrite port with the provided value if set

Return type:



string which contains all cli parameters


Convert the dictionary into a string to pass it as argument in k8s. :param dictionary: dictionary which has to be passed as argument in k8s.

Return type:



string representation of the dictionary