Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list listPodForAllNamespaces error #3390

Open
luca-ma opened this issue May 8, 2024 · 5 comments
Open

list listPodForAllNamespaces error #3390

luca-ma opened this issue May 8, 2024 · 5 comments

Comments

@luca-ma
Copy link

luca-ma commented May 8, 2024

Describe the bug
Hi,
I'm using your example
https://github.com/kubernetes-client/java/blob/master/examples/examples-release-18/src/main/java/io/kubernetes/client/examples/Example.java
to get all Pod in a K8s cluster.

CoreV1Api.listPodForAllNamespaces return a 401 response.

Could you suggest how to configure the client to correctly access the cluster?
thanks in advance
luca

Client Version
13.0.0

Kubernetes Version
1.29

Java Version
java 11

@brendandburns
Copy link
Contributor

401 indicates that you are not authorized. That's probably not an error in this client, depending on where you are running the code you may need to add permissions for a pod service account or ensure that you have a kubeconfig file in the right location.

@brendandburns
Copy link
Contributor

Also, client version 0.13.0 is_very_ old, please update to the latest client.

@luca-ma
Copy link
Author

luca-ma commented May 9, 2024 via email

@luca-ma
Copy link
Author

luca-ma commented May 9, 2024 via email

@brendandburns
Copy link
Contributor

That FAQ entry is for Pods running inside the cluster, but it sounds like you are accessing from outside the cluster.

In that case you need some way to authenticate and authorize your client. The easiest way to do that is to supply a Kubeconfig file, alternately you can set up the client programatically with a certificate/token for doing authentication, but that is definitely harder.

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

No branches or pull requests

2 participants