-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Which project are you reporting a bug for?
kr8s
What happened?
If I use kubectl
inside a Pod without providing a service account or any configuration it defaults to using the same namespace the Pod is running in. But kr8s
just uses default
.
To reproduce create a new namespace and start an interactive Pod inside it.
Create a new namespace
$ kubectl create namespace foo
namespace "foo" created
Run an interactive Pod in that namespace
$ kubectl run python --image python --namespace foo --rm -it -- bash
Install kubectl
and try to list Pods.
Install kubectl
# apt update && apt install curl -y && curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && chmod +x kubectl && mv kubectl /usr/local/bin/
...
Try to list Pods
# kubectl get pods
Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:foo:default" cannot list resource "pods" in API group "" in the namespace "foo"
Note the error says cannot list resource "pods" in API group "" in the namespace "foo"
.
However if I do the same thing with kr8s
it uses the default
namespace.
Install kr8s
# pip install kr8s
...
Try to list Pods
# python -c 'import kr8s; kr8s.get("pods")'
...
kr8s._exceptions.ServerError: pods is forbidden: User "system:serviceaccount:foo:default" cannot list resource "pods" in API group "" in the namespace "default"
Note the error says cannot list resource "pods" in API group "" in the namespace "default"
.
Anything else?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working