Automated Kerberos Install for HDP w/ Ambari + Puppet

With the release of Ambari 2.x kerberizing a HDP install improved quite a bit. Looking back at Kerberized Hadoop Cluster – A Sandbox Example compared to today most of the there described steps are much easier by now and can be automated. For long I was looking to include it into my existing Vagrant project for an end to end setup of a kerberized cluster. With the writing of this post I finally had the opportunity to do so.

In this post I would like to describe the parts added to the Vagrant setting needed to accomplish an end to end setup of a kerberized HDP cluster. Before the final step of the cluster setup by using the Ambari REST API, a KDC with credentials needs to be created. A Puppet module was created and included to achieve the installation of a MIT Kerberos install.

Install and Setup MIT Kerberos with Puppet

Additionally to the already existing parameters for the KDC the realm ( :krb5_realm ) and the KDC host ( :krb5_host) have to be added to the HDP config file required for the setup (example config hdp.rb):

This parameters are added to the puppet.facter to be used by the Vagrant file:

The Puppet module for the KDC setup is placed under puppet/modules/kerberos containing a pretty straight forward implementation of a typical module. There is probably only one thing that might catch your attention, which is the use of the rng service. In some environments there is not enough entropy (randomness) for the KDC to encrypt its database, without this a install would timeout. The service is not stopped at the end keeping it running. You can stop it manually after the install if you really want.

Creating the KDC is one part but also the cluster needs to be kerberized. A specific puppet module was created for that part, which can be added to the node manifest if wanted.

The module is quite simple and can be added to a node manifest in the following way:

Automated Kerberos Install

As you can already see from the above Puppet module a python script is being used to setup the cluster. The script itself uses the Ambari REST API to add the Kerberos service to the cluster, create the appropriate config, enable Kerberos, and restart the cluster. The full script can be found here.

Adding the Kerberos service with it’s component KERBEROS_CLIENT to the cluster:

Next we need to create the configuration for the Kerberos service. It consists of two configuration parts kerberos-env and krb-conf. Typically the krb5-conf configuration would also contain the content of the krb5.conf file under /etc/. Ambari would also manage the content in that file. If your are managing that content by yourself you can disable this functionality by setting manage_krb5_conf to false. This is also done here, as the krb5.conf is created and managed by Puppet with the above module and the template can be found here. Here we leave content emtpy and tell Ambari not to manage the krb5.conf:

Next the components will get installed cluster wide on each host:

Last but not least the kerberos install needs to be enabled by providing the necessary admin credentials for the creation of the principals. Ambari will create the required principals distributing the keytabs to each host. With this the enablement is accomplished and the cluster can be restarted.

Done is the kerberized install.

Further Readings

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *