How to fix "Forbidden!Configured service account doesn't have access" with Spark on Kubernetes? How to fix "Forbidden!Configured service account doesn't have access" with Spark on Kubernetes? kubernetes kubernetes

How to fix "Forbidden!Configured service account doesn't have access" with Spark on Kubernetes?


Hello I had the same issue. I then found this Github issue https://github.com/GoogleCloudPlatform/continuous-deployment-on-kubernetes/issues/113

That point me to the problem. I solved the issue following the Spark guide for RBAC cluster herehttps://github.com/GoogleCloudPlatform/continuous-deployment-on-kubernetes/issues/113

Create a serviceaccount

kubectl create serviceaccount spark

Give the service account the edit role on the cluster

kubectl create clusterrolebinding spark-role --clusterrole=edit --serviceaccount=default:spark --namespace=default

Run spark submit with the following flag, in order to run it with the (just created(service account)

--conf spark.kubernetes.authenticate.driver.serviceAccountName=spark

Hope it helps!