Question: how to generate krb5.keytab file?
Answer: Log on as theKerberos administrator (Admin) and create a principal in the KDC. You can use cluster-wide or host-based credentials. ... 
Obtain the key of the principal by running the subcommand getprinc principal_name .
Create the keytab files, using the ktutil command: