class_docstr: An orchestrator implmentation which uses Kubernetes to deploy the components such as training and rollout workers
  and Redis Pub/Sub in Coach when used in the distributed mode.
class_docstr_tok: ["An","orchestrator","implmentation","which","uses","Kubernetes","to","deploy","the","components","such","as","training","and","rollout","workers","and","Redis","Pub\/Sub","in","Coach","when","used","in","the","distributed","mode","."]
docstr: :param params: The Kubernetes parameters which are used for deploying the components in Coach. These parameters
  include namespace and kubeconfig.
docstr_tok: [":","param","params",":","The","Kubernetes","parameters","which","are","used","for","deploying","the","components","in","Coach",".","These","parameters","include","namespace","and","kubeconfig","."]
code: def __init__(self, params: KubernetesParameters):
      """
      :param params: The Kubernetes parameters which are used for deploying the components in Coach. These parameters
      include namespace and kubeconfig.
      """
  
      super().__init__(params)
      self.params = params
      if self.params.kubeconfig:
          k8sconfig.load_kube_config()
      else:
          k8sconfig.load_incluster_config()
  
      if not self.params.namespace:
          _, current_context = k8sconfig.list_kube_config_contexts()
          self.params.namespace = current_context["context"][
              "namespace"
          ]
  
      if os.environ.get("http_proxy"):
          k8sclient.Configuration._default.proxy = os.environ.get(
              "http_proxy"
          )
  
      self.params.memory_backend_parameters.orchestrator_params = {
          "namespace": self.params.namespace
      }
      self.memory_backend = get_memory_backend(
          self.params.memory_backend_parameters
      )
  
      self.params.data_store_params.orchestrator_params = {
          "namespace": self.params.namespace
      }
      self.params.data_store_params.namespace = self.params.namespace
      self.data_store = get_data_store(self.params.data_store_params)
  
      if self.params.data_store_params.store_type == "s3":
          self.s3_access_key = None
          self.s3_secret_key = None
          if self.params.data_store_params.creds_file:
              s3config = ConfigParser()
              s3config.read(self.params.data_store_params.creds_file)
              try:
                  self.s3_access_key = s3config.get(
                      "default", "aws_access_key_id"
                  )
                  self.s3_secret_key = s3config.get(
                      "default", "aws_secret_access_key"
                  )
              except Error as e:
                  screen.print(
                      "Error when reading S3 credentials file: %s", e
                  )
          else:
              self.s3_access_key = os.environ.get("ACCESS_KEY_ID")
              self.s3_secret_key = os.environ.get("SECRET_ACCESS_KEY")
  
imports: import os
  import uuid
  import json
  import time
  import sys
  from enum import Enum
  from typing import List
  from configparser import ConfigParser, Error
  from multiprocessing import Process
  from rl_coach.base_parameters import RunType
  from rl_coach.orchestrators.deploy import Deploy, DeployParameters
  from kubernetes import client, config
  from rl_coach.memories.backend.memory import MemoryBackendParameters
  from rl_coach.memories.backend.memory_impl import get_memory_backend
  from rl_coach.data_stores.data_store import DataStoreParameters
  from rl_coach.data_stores.data_store_impl import get_data_store
  from rl_coach.logger import screen
label_desc: Use image node_id 1 to create a new Kubernetes object from inherited base classes: Deploy with example: obj = Kubernetes(params)