We are trying to connect our RStudio to our kerberized HDP cluster and happen to encounter some errors while doing so. Currently, I have an RScript to connect to livy on another host but I receive "Failed to connect to Livy service at http://XXX:8999. Livy operation is unauthorized. Try spark_connect with config = livy_config()"
We were able to make a connection by adding Livy by performing the following:
Add Livy to knox gateway in kerberized cluster (Ambari). Instructions to add livy to knox are here, but instead of using the service.xml and rewrite.xml they use I would use the knox provided one fro Github found here. Restart Knox after changes are applied.
You'll have to add the livy service to Ranger to allow access to a given set of users
In Ambari you'll have to have knox to the livy superusers to get proxy user impersonation to work. Essentialy, this will allow livy sessions to be created as the proxy user (user123) instead of "knox".