I have a Spring application that reads a file from HDFS using WebHDFS. When I test it in IDEA, it works. But after I build the project and deploy the Docker image on a virtual machine locally or on a server connected to HDFS, I get:
AuthenticationException: Unauthorized
On my local machine I have to regularly initialize the token with
kinit
for autentication. If I don't, I get the same error. I tested the app without Docker on a server, it also works. I think the Docker image does not see the token. But I don't know what to do about it.
Kerberos is used for security.
Any advice?
Okey. I did it. There were a few problems, but this is how the final variant looks.
My docker. krb5.conf and keytab are in the same folder as my docker file. When I build the project they are added to the container and in the entrypoint I use
to provide krb5 location. There are also a few options for debugging + I connect mongo.
Then I use
KerberosRestTemplate
to connect to webhdfsIf you want to run the app without docker, just build it and add the keytab to the same direction as the jar. Then change
/etc/evkuzmin.keytab
so it points to the new location.