Reputation: 123
enter image description hereI have deployed Jenkins container inside the k8s cluster successfuly but I can't able to execute "kubectl get pod -A" where as kubectl also installed inside the Jenkins container. How can I run k8s command inside the Jenkins container so I can able to apply CI/CD for k8s. Below is the errors when I run k8s command inside the Jenkins container which is running inside the k8s pod.
Upvotes: 0
Views: 299
Reputation: 4444
You need to create the cluster role binding for the service account jenkins.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: jenkins-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: jenkins
namespace: jenkins
kubectl apply -f sa.yaml
Upvotes: 1