haoxiaofei
haoxiaofei

Reputation: 1

jenkins use kubernetes plugin to deploy slave ,but in the slave containers,can not use kubectl

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!

Upvotes: 0

Views: 204

Answers (1)

Bilal Ahmad
Bilal Ahmad

Reputation: 352

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

Upvotes: 1

Related Questions