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

3/18/2019

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!

-- haoxiaofei
jenkins
kubectl
kubernetes
slave

1 Answer

9/7/2019

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
-- Bilal Ahmad
Source: StackOverflow