Comments (14)
Kubectl uses go client to talk to api server. Kube-shell uses client-python to talk to api server for resource auto completion. there seems to some problem python api client accessing api server.
Could you please try below snippet from your python interactive shell and see if this goes through?
from kubernetes import client, config
config.load_kube_config()
v1 = client.CoreV1Api()
v1.list_pod_for_all_namespaces(watch=False)
from kube-shell.
Still throws an error.
> python 13:10:54
Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from kubernetes import client, config
>>> config.load_kube_config()
>>> v1 = client.CoreV1Api()
>>> v1.list_pod_for_all_namespaces(watch=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 13650, in list_pod_for_all_namespaces
(data) = self.list_pod_for_all_namespaces_with_http_info(**kwargs)
File "/usr/local/lib/python2.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 13743, in list_pod_for_all_namespaces_with_http_info
collection_formats=collection_formats)
File "/usr/local/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 329, in call_api
_return_http_data_only, collection_formats, _preload_content, _request_timeout)
File "/usr/local/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 153, in __call_api
_request_timeout=_request_timeout)
File "/usr/local/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 361, in request
headers=headers)
File "/usr/local/lib/python2.7/site-packages/kubernetes/client/rest.py", line 240, in GET
query_params=query_params)
File "/usr/local/lib/python2.7/site-packages/kubernetes/client/rest.py", line 231, in request
raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Date': 'Wed, 05 Jul 2017 18:18:49 GMT', 'Content-Length': '13', 'Content-Type': 'text/plain; charset=utf-8', 'X-Content-Type-Options': 'nosniff'})
HTTP response body: Unauthorized
>>>
from kube-shell.
Can you share details of your cluster? (Is it on gke or gce or minikube).
from kube-shell.
It's a CoreOS Tectonic cluster on AWS. RBAC is enabled.
from kube-shell.
Also I'm just using static users at the moment, if that's of any value to the error.
https://coreos.com/tectonic/docs/latest/admin/user-management.html
from kube-shell.
Same problem here with GKE
from kube-shell.
The authentication problems are described in a bug within client-python here. The workaround provided is to use service accounts.
I'll dig through the client-python code a little today.
Before I make a change to the code, @clmssz are you using GKE with service accounts?
In the short term I propose to handle kube-apiserver endpoint errors like this without disabling the shell's utility.
from kube-shell.
@vogxn kubectl uses your gcloud compute credentials I think
from kube-shell.
I've redirected the errors to an error log. Kubeshell will not dump stacktraces like this now. The pull request is here
You can test this by installing from the branch
$ pip install -e git://github.com/vogxn/kube-shell.git@26-handle-client-python-errors#egg=kube-shell
from kube-shell.
This is now merged and will be part of the next release along with other bugfixes.
from kube-shell.
A new release is pushed to pypi with version 0.0.21
. An upgrade should fix this issue
from kube-shell.
Hi @vogxn , no more stacktrace thanks (but no completion, guess it'a what you wanted in the short term right ?)
from kube-shell.
Kubernetes python client 3.0.0b1 should have a fix for this. Can you guys give it a try and let me know if it fixed your problem?
from kube-shell.
Any progress on this? the auto completion is what made we want to use it
from kube-shell.
Related Issues (20)
- [UX] YAML syntax highlight?
- Error when input backslash : No escaped character
- how can I switch multiple clusters? HOT 2
- Standard install broken on debian stretch
- Best way to collaborate?
- Server-side autocomplete doesn't work on kubernetes object names with Ubuntu 18.10 HOT 2
- Unable to use kube-shell in wsl (alpine)
- Python 3.7 support (fix deprecated yaml call) HOT 3
- Kube-shell for Windows is not passing input text to kubectl HOT 1
- on startup on RHEL 7.6 notebook get load errors
- [INFORMATION SHARE] A web based kubectl tool.
- Fix simple typo: recieve -> receive
- Execution error HOT 1
- rename-context missing from completion
- command not found: kubeshell HOT 3
- Autosuggestion isn't working on List of available pods HOT 1
- Warning while loading Kube-shell HOT 4
- Customize shell prompt
- Command not found HOT 2
- F5 button not able to change namespace
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.