Scenario:
There are few stages( i.e Kafka ) in which allow an option to put keytab at runtime, this option would require keytab in base64 encoded format.
Answer:
We need to follow the below steps to convert the keytab into base64 encoded format

Step-1, Pass the keytab with an absolute location, It'll generate the output file with base64 encode
Step-2, It'll remove all whitespace including newlines the encoded output
Please use the output (which is encoded in base64) of step-2 as run time keytab