0
votes

I use jenkins k8s plugin to deploy slave node,but in the slave container,can not use kubectl,the error is :

User "system:serviceaccount:default:default" cannot list resource "pods" in API group "" in the namespace "default"

Nearly, I done a thing like docker run a slave , but it's ok, the docker containers can use kubectl, why? thanks!

1
Please start your investigation with kubectl get roles,rolebindings,sa. Could you please provide more details (environment parameters, jenkins deployment and steps to reproduce this issue?) Please provide your env details as yaml outputs. You can use also kubectl get all --all-namespaces to provide more details.Mark

1 Answers

1
votes

You need to create a role for cluster-admin for your user:

kubectl create clusterrolebinding permissive-binding --clusterrole=cluster-admin --user=admin --user=kubelet --group=system:serviceaccounts