Page MenuHomePhabricator

Problem with kubernetes not being able to read ~/.kube/config file.
Closed, ResolvedPublic

Description

I have just created a tool (wembedder) on Tools Labs and trying to get a Python Flask webserver up and running. I have made a venv in Python3 so I would use kurbernetes (AFAIU). I am trying something like:

webservice --backend=kubernetes python

I get an error message:

(venv)tools.wembedder@tools-bastion-03:~$ webservice --backend=kubernetes python status
Traceback (most recent call last):
  File "/usr/local/bin/webservice", line 131, in <module>
    job = KubernetesBackend(tool, args.type, args.extra_args)
  File "/usr/lib/python2.7/dist-packages/toollabs/webservice/backends/kubernetesbackend.py", line 174, in __init__
    os.path.expanduser('~/.kube/config')
  File "/usr/lib/python2.7/dist-packages/pykube/config.py", line 72, in from_file
    raise exceptions.PyKubeError("Configuration file {} not found".format(filename))
pykube.exceptions.PyKubeError: Configuration file /data/project/wembedder/.kube/config not found

My .kube directory is owned by root for some reason (I see that another tool I have it is owned by the tool user).

(venv)tools.wembedder@tools-bastion-03:~$ ls -al .kube/
total 8
drwxr-sr-x 2 root            tools.wembedder 4096 Jul  5 08:16 .
drwxrwsr-x 9 tools.wembedder tools.wembedder 4096 Jul  5 10:30 ..

I wonder if that is a problem? Is the config file missing or will it be constructed with the webservice call? Should a sysadm change the permissions on the ~/.kube/ directory? Or is it something I can do?

I see no job with qstat. I have erased the ~/service.manifest (I believe that came after I tried starting it with uwsgi-python or uwsgi-plain).

Event Timeline

I have managed to get it going with --backend=gridengine uwsgi-plain, but I suppose it would perhaps be nice to have the kubernetes issue fixed, - if it is not something that is specific to me.

bd808 changed the task status from Duplicate to Resolved.Jul 5 2017, 3:28 PM
bd808 claimed this task.
bd808 subscribed.

This was caused by errors I introduced in the maintain-kubeusers script in rOPUPaedd88271f08: tools: have maintain-kubeusers chown $HOME/.kube while working on T165875: Update maintain-kubeusers to allow tool's to write to $HOME/.kube. We just merged the fix from rOPUP885ef978b906: tools: Fix maintain-kubeusers and restarted the process. The /data/project/wembedder/.kube/config file has been created now.