class_docstr: An implementation of data store which uses NFS for storing policy checkpoints when using Coach in distributed mode.
  The policy checkpoints are written by the trainer and read by the rollout worker.
class_docstr_tok: ["An","implementation","of","data","store","which","uses","NFS","for","storing","policy","checkpoints","when","using","Coach","in","distributed","mode",".","The","policy","checkpoints","are","written","by","the","trainer","and","read","by","the","rollout","worker","."]
docstr: Deploy the NFS server in the Kubernetes orchestrator.
docstr_tok: ["Deploy","the","NFS","server","in","the","Kubernetes","orchestrator","."]
code: def deploy_k8s_nfs(self) -> bool:
      """
      Deploy the NFS server in the Kubernetes orchestrator.
      """
      from kubernetes import client as k8sclient
  
      name = "nfs-server-{}".format(uuid.uuid4())
      container = k8sclient.V1Container(
          name=name,
          image="k8s.gcr.io/volume-nfs:0.8",
          ports=[
              k8sclient.V1ContainerPort(
                  name="nfs", container_port=2049, protocol="TCP"
              ),
              k8sclient.V1ContainerPort(
                  name="rpcbind", container_port=111
              ),
              k8sclient.V1ContainerPort(
                  name="mountd", container_port=20048
              ),
          ],
          volume_mounts=[
              k8sclient.V1VolumeMount(
                  name="nfs-host-path", mount_path="/exports"
              )
          ],
          security_context=k8sclient.V1SecurityContext(privileged=True),
      )
      template = k8sclient.V1PodTemplateSpec(
          metadata=k8sclient.V1ObjectMeta(labels={"app": name}),
          spec=k8sclient.V1PodSpec(
              containers=[container],
              volumes=[
                  k8sclient.V1Volume(
                      name="nfs-host-path",
                      host_path=k8sclient.V1HostPathVolumeSource(
                          path="/tmp/nfsexports-{}".format(uuid.uuid4())
                      ),
                  )
              ],
          ),
      )
      deployment_spec = k8sclient.V1DeploymentSpec(
          replicas=1,
          template=template,
          selector=k8sclient.V1LabelSelector(
              match_labels={"app": name}
          ),
      )
  
      deployment = k8sclient.V1Deployment(
          api_version="apps/v1",
          kind="Deployment",
          metadata=k8sclient.V1ObjectMeta(
              name=name, labels={"app": name}
          ),
          spec=deployment_spec,
      )
  
      k8s_apps_v1_api_client = k8sclient.AppsV1Api()
      try:
          k8s_apps_v1_api_client.create_namespaced_deployment(
              self.params.namespace, deployment
          )
          self.params.name = name
      except k8sclient.rest.ApiException as e:
          screen.print(
              "Got exception: %s\n while creating nfs-server", e
          )
          return False
  
      k8s_core_v1_api_client = k8sclient.CoreV1Api()
  
      svc_name = "nfs-service-{}".format(uuid.uuid4())
      service = k8sclient.V1Service(
          api_version="v1",
          kind="Service",
          metadata=k8sclient.V1ObjectMeta(name=svc_name),
          spec=k8sclient.V1ServiceSpec(
              selector={"app": self.params.name},
              ports=[
                  k8sclient.V1ServicePort(
                      protocol="TCP", port=2049, target_port=2049
                  )
              ],
          ),
      )
  
      try:
          svc_response = (
              k8s_core_v1_api_client.create_namespaced_service(
                  self.params.namespace, service
              )
          )
          self.params.svc_name = svc_name
          self.params.server = svc_response.spec.cluster_ip
      except k8sclient.rest.ApiException as e:
          screen.print(
              "Got exception: %s\n while creating a service for nfs-server",
              e,
          )
          return False
  
      return True
  
file_path: coach/rl_coach/data_stores/nfs_data_store.py
imports: import uuid
  from rl_coach.data_stores.data_store import DataStoreParameters
  from rl_coach.data_stores.checkpoint_data_store import CheckpointDataStore
  from rl_coach.logger import screen
label_desc: Use image node_id 7 for calling the NFSDataStore obj's underlying member method code with example usage: obj.deploy_k8s_nfs() and returns: True, False, False