code: def init_spark_on_k8s(
      self,
      master,
      container_image,
      conda_name,
      num_executors,
      executor_cores,
      executor_memory="2g",
      driver_memory="1g",
      driver_cores=4,
      extra_executor_memory_for_ray=None,
      extra_python_lib=None,
      penv_archive=None,
      conf=None,
      jars=None,
      python_location=None,
  ):
      print("Initializing SparkContext for k8s-client mode")
      executor_python_env = "python_env"
      os.environ["PYSPARK_PYTHON"] = "{}/bin/python".format(
          executor_python_env
      )
      pack_env = False
      invalidInputError(
          penv_archive or conda_name,
          "You should either specify penv_archive or conda_name explicitly",
      )
      try:
          if not penv_archive:
              penv_archive = pack_penv(conda_name, executor_python_env)
              pack_env = True
  
          archive = "{}#{}".format(penv_archive, executor_python_env)
  
          submit_args = "--master " + master + " --deploy-mode client"
          submit_args = submit_args + " --archives {}".format(archive)
          submit_args = submit_args + gen_submit_args(
              driver_cores,
              driver_memory,
              num_executors,
              executor_cores,
              executor_memory,
              extra_python_lib,
              jars,
          )
          submit_args = (
              submit_args + " --jars " + ",".join(get_bigdl_jars())
          )
  
          conf = enrich_conf_for_spark(
              conf,
              driver_cores,
              driver_memory,
              num_executors,
              executor_cores,
              executor_memory,
              extra_executor_memory_for_ray,
          )
          py_version = ".".join(
              platform.python_version().split(".")[0:2]
          )
          preload_so = (
              executor_python_env
              + "/lib/libpython"
              + py_version
              + "m.so"
          )
          ld_path = (
              executor_python_env
              + "/lib:"
              + executor_python_env
              + "/lib/python"
              + py_version
              + "/lib-dynload"
          )
          image_workdir = get_bigdl_image_workdir()
          tf_libs_path = (
              image_workdir
              + "/"
              + executor_python_env
              + "/lib/python"
              + py_version
              + "/site-packages/bigdl/share/tflibs"
          )
          if "spark.executor.extraLibraryPath" in conf:
              ld_path = "{}:{}".format(
                  ld_path, conf["spark.executor.extraLibraryPath"]
              )
          conf.update(
              {
                  "spark.cores.max": num_executors * executor_cores,
                  "spark.executorEnv.PYTHONHOME": executor_python_env,
                  "spark.executorEnv.TF_LIBS_PATH": tf_libs_path,
                  "spark.executor.extraLibraryPath": ld_path,
                  "spark.executorEnv.LD_PRELOAD": preload_so,
                  "spark.kubernetes.container.image": container_image,
              }
          )
          if "spark.driver.host" not in conf:
              conf["spark.driver.host"] = get_node_ip()
          if "spark.driver.port" not in conf:
              conf["spark.driver.port"] = random.randint(10000, 65535)
  
          sc = self.create_sc(submit_args, conf)
      finally:
          if conda_name and penv_archive and pack_env:
              os.remove(penv_archive)
      return sc
  
imports: import os
  import sys
  import random
  import platform
  from pyspark import SparkContext
  from bigdl.dllib.nncontext import init_internal_nncontext, init_spark_conf
  from bigdl.dllib.utils.utils import detect_python_location, pack_penv, get_node_ip
  from bigdl.dllib.utils.utils import get_executor_conda_zoo_classpath
  from bigdl.dllib.utils.utils import get_zoo_bigdl_classpath_on_driver
  from bigdl.dllib.utils.utils import get_bigdl_class_version
  from bigdl.dllib.utils.utils import get_bigdl_image_workdir
  from bigdl.dllib.utils.utils import is_valid_ip_address
  from bigdl.dllib.utils.engine import get_bigdl_jars
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 8 for calling the SparkRunner obj's underlying member method code with example usage: obj.init_spark_on_k8s(master, container_image, conda_name, num_executors, executor_cores, executor_memory, driver_memory, driver_cores, extra_executor_memory_for_ray, extra_python_lib, penv_archive, conf, jars, python_location) and returns: sc