question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation for launching on Google Kubernetes

See original GitHub issue

I’m following the Google Kubernetes docs for launching a cluster via the command line, and everything works. When I attempt to start a KubeCluster, I don’t seem to have a worker_spec.yml that actually works. Perhaps I’m missing information in the yaml?

Launching a cluster: gcloud container clusters create dask-cluster Out:

Created [https://container.googleapis.com/v1/projects/phrasal-fire-198816/zones/us-east1-d/clusters/dask-cluster].
WARNING: environment variable HOME or KUBECONFIG must be set to store credentials for kubectl
NAME          ZONE        MASTER_VERSION  MASTER_IP       MACHINE_TYPE   NODE_VERSION  NUM_NODES  STATUS
dask-cluster  us-east1-d  1.8.8-gke.0     35.196.157.198  n1-standard-1  1.8.8-gke.0   3          RUNNING

Then in a Jupyter notebook I used:

from dask_kubernetes import KubeCluster
cluster = KubeCluster.from_yaml('worker-spec.yaml')

And I get this nice error:

---------------------------------------------------------------------------
ConfigException                           Traceback (most recent call last)
~\Anaconda3\lib\site-packages\dask_kubernetes\core.py in __init__(self, pod_template, name, namespace, n_workers, host, port, env, **kwargs)
    150         try:
--> 151             kubernetes.config.load_incluster_config()
    152         except kubernetes.config.ConfigException:

~\Anaconda3\lib\site-packages\kubernetes\config\incluster_config.py in load_incluster_config()
     92     InClusterConfigLoader(token_filename=SERVICE_TOKEN_FILENAME,
---> 93                           cert_filename=SERVICE_CERT_FILENAME).load_and_set()

~\Anaconda3\lib\site-packages\kubernetes\config\incluster_config.py in load_and_set(self)
     44     def load_and_set(self):
---> 45         self._load_config()
     46         self._set_config()

~\Anaconda3\lib\site-packages\kubernetes\config\incluster_config.py in _load_config(self)
     50                 SERVICE_PORT_ENV_NAME not in self._environ):
---> 51             raise ConfigException("Service host/port is not set.")
     52 

ConfigException: Service host/port is not set.

During handling of the above exception, another exception occurred:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-8-fc55ef0ba3d4> in <module>()
----> 1 cluster = KubeCluster.from_yaml('worker-spec.yaml')

~\Anaconda3\lib\site-packages\dask_kubernetes\core.py in from_yaml(cls, yaml_path, **kwargs)
    248         with open(yaml_path) as f:
    249             d = yaml.safe_load(f)
--> 250             return cls.from_dict(d, **kwargs)
    251 
    252     @property

~\Anaconda3\lib\site-packages\dask_kubernetes\core.py in from_dict(cls, pod_spec, **kwargs)
    213         KubeCluster.from_yaml
    214         """
--> 215         return cls(make_pod_from_dict(pod_spec), **kwargs)
    216 
    217     @classmethod

~\Anaconda3\lib\site-packages\dask_kubernetes\core.py in __init__(self, pod_template, name, namespace, n_workers, host, port, env, **kwargs)
    151             kubernetes.config.load_incluster_config()
    152         except kubernetes.config.ConfigException:
--> 153             kubernetes.config.load_kube_config()
    154 
    155         self.core_api = kubernetes.client.CoreV1Api()

~\Anaconda3\lib\site-packages\kubernetes\config\kube_config.py in load_kube_config(config_file, context, client_configuration, persist_config)
    356     loader = _get_kube_config_loader_for_yaml_file(
    357         config_file, active_context=context,
--> 358         config_persister=config_persister)
    359     if client_configuration is None:
    360         config = type.__call__(Configuration)

~\Anaconda3\lib\site-packages\kubernetes\config\kube_config.py in _get_kube_config_loader_for_yaml_file(filename, **kwargs)
    313 
    314 def _get_kube_config_loader_for_yaml_file(filename, **kwargs):
--> 315     with open(filename) as f:
    316         return KubeConfigLoader(
    317             config_dict=yaml.load(f),

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Brendan/.kube/config'

My worker spec yaml, which only has the “name” attribute changed from the dask-kubernetes docs:

kind: Pod
metadata:
  name: dask-cluster
  labels:
    app: dask-ml
    
spec:
  restartPolicy: Never
  containers:
  - name: aksbdgka
    image: daskdev/dask:latest
    args: [dask-worker, --nthreads, '2', --no-bokeh, --memory-limit, 6GB, --death-timeout, '60']
    env:
      - name: EXTRA_PIP_PACKAGES
        value: fastparquet git+https://github.com/dask/distributed
    resources:
      limits:
        cpu: "2"
        memory: 6G
      requests:
        cpu: "2"
        memory: 6G

I’m not really sure how the KubeCluster actually interfaces with gcloud, so I have no idea what to look for to solve the problem and get the cluster running with dask.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mrocklincommented, Apr 1, 2018

KubeCluster isn’t designed to interface directly with gcloud. It is designed to be run from a pod on a Kubernetes cluster that has permissions to launch other pods.

If you’re just looking to get started with Dask on GCloud then you might want to try the helm chart instead. These docs would have more information. http://dask.pydata.org/en/latest/setup/kubernetes.html

0reactions
BrendanMartincommented, Apr 5, 2018

Thanks for your help. I think I’m good to go now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quickstart: Deploy an app to a GKE cluster - Google Cloud
Deploy a simple web server containerized application to Google Kubernetes Engine. ... Before you begin; Launch Cloud Shell; Create a GKE cluster.
Read more >
Kubernetes on Google Cloud (GKE)
Start Google Cloud Shell from console.cloud.google.com by clicking the button shown ... Additional documentation about Google Cloud shell is available here.
Read more >
Kubernetes Documentation
Kubernetes is an open source container orchestration engine for automating deployment, scaling, and management of containerized applications ...
Read more >
Google Kubernetes Engine (GKE) | Okteto Documentation
This guide will show you how to install Okteto onto Google Kubernetes Engine (GKE). We'll be focusing exclusively on GKE in order to...
Read more >
Quick Start with Google Kubernetes Engine - Istio
Refer to the Istio on GKE documentation 3 for instructions on creating a cluster with Istio installed. Once the cluster is ready, acquire...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found