Error while using Kerberos keytab principal in openshift

5/23/2020

I have a python flask API hosted on OpenShift which is running fine. Now I want to connect an SQL database to the API using Kerberos authentication. I have successfully created a keytab file using the ktutil command in the pod terminal. Now I want to reuse this keytab file for further builds. I have downloaded the keytab file and placed it in the stash for a further build. I am getting an error while building the application on the knit command.

Error: Invalid UID in persistent keyring name while getting default cache

However, when I comment these lines out in the docker file, the build is successful and the same kinit command gets executed from the latest pod terminal and is able to connect to the SQL database.

Docker code:

### copy keytab file and conf file
ADD ./home/* /home/

# config key tab
RUN export KRB5_CONFIG =/home/krb5.conf
RUN kinit sysaccount@domain.com -v -k -t /home/sysaccount.keytab   #error on this line

I just want to automate this process. When I redeploy the code, the connection should be established.

Many Thanks in advance.

-- Vishwa
flask-restful
kerberos
kubernetes

0 Answers