Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

no config file found: If installed by kubeadm #110

Open
gangadhars opened this issue Jan 10, 2017 · 4 comments
Open

no config file found: If installed by kubeadm #110

gangadhars opened this issue Jan 10, 2017 · 4 comments

Comments

@gangadhars
Copy link

I have install kubernetes by using kubeadm (http://kubernetes.io/docs/getting-started-guides/kubeadm/).
I didn't find any config file.

Thanks

@ericharnold
Copy link

The kubeconfig file you are looking for is at /etc/kubernetes/admin.conf on the kubectl master node. You need to sudo to see this file. I copied this file to my user space at /home/myuser/admin.conf, did a chown to my user, and then scp'd the file to my app's git repo. Then I was able to access the kubectl master node remotely via pykube using the credentials in the admin.conf file

api = pykube.HTTPClient(pykube.KubeConfig.from_file("/home/myuser/git/myproject/kubectl/config/mycluster/admin.conf"))

@gangadhars
Copy link
Author

Hi ericharnold!

I found the admin.conf file but I'm getting below error:

Traceback (most recent call last):
  File "ns.py", line 6, in <module>
    namespaces = filter(operator.attrgetter("name"), response)
  File "/usr/local/lib/python2.7/dist-packages/pykube/query.py", line 130, in __iter__
    return iter(self.query_cache["objects"])
  File "/usr/local/lib/python2.7/dist-packages/pykube/query.py", line 120, in query_cache
    cache["response"] = self.execute().json()
  File "/usr/local/lib/python2.7/dist-packages/pykube/query.py", line 104, in execute
    r = self.api.get(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pykube/http.py", line 127, in get
    return self.session.get(*args, **self.get_kwargs(**kwargs))
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: hostname '172.16.2.120' doesn't match either of 'kubernetes', 'kubernetes.default', 'kubernetes.default.svc', 'kubernetes.default.svc.cluster.local', '172.16.2.120', '10.96.0.1'

Thanks

@ericharnold
Copy link

You may have SSL cert issues based on the hostnames you assigned to your nodes before you deployed kubeadm for the first time. We found that we had to assign fully qualified hostnames in Ubuntu in the cluster.local domain before we installed kubeadm. For example we set hostnames to node1.cluster.local, node2.cluster.local, etc. This includes updating both the /etc/hostname and /etc/hosts files using this name. Then we installed kubeadm init and kubeadm join and all the K8s nodes now have the fully qualified hostname when you display kubectl get nodes. This was also necessary to find the pod logs in the Kubernetes dashboard web interface. It seems that kube-dns depends on this.

@wsbmilk
Copy link

wsbmilk commented Jan 16, 2017

use insecure_url for kube-apiserver OR use kubectl proxy may resolve it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants