Installing Red Hat Container Development Kit on Fedora

Fedora users seeking help on installing Container Development Kit (CDK), here is how you can install CDK 2.2 on your Fedora 24. These same steps can be used for CDK 2.3 too.

CDK provides a container development environment, to build production-grade applications, for use on OpenShift.

The installation of CDK 2.2 on Fedora essentially involves the following stages:

Setting up your virtualization environment
You need to first install the virtualization software, in this case, KVM/libvirt, and then proceed to install Vagrant and its additional plugins to enable the various features of CDK.

  1. Install KVM and libvirt:
    $ sudo dnf install @Virtualization
  2. Launch the libvirt daemon and configure it to start at boot:
    $ sudo systemctl start libvirtd
    $ sudo systemctl enable libvirtd
  3. Install Vagrant and the other required vagrant-libvirt plugins:
    $ sudo dnf install vagrant vagrant-libvirt vagrant-libvirt-doc vagrant-registration rubygem-ruby-libvirt
  4. A PolicyKit rule needs to be added that allows users in the vagrant group to control VMs through libvirt. Add the PolicyKit rule on to your system:
    $ sudo cp /usr/share/vagrant/gems/doc/vagrant-libvirt-*/polkit/10-vagrant-libvirt.rules /etc/polkit-1/rules.d
    Note: Starting from Fedora 25 the PolicyKit rule is no longer shipped. So Fedora 25 users should follow these steps, instead of the one mentioned above:
    $ sudo gpasswd -a ${USER} libvirt
    $ newgrp libvirt

    This would add the user to the libvirt UNIX group.
  5. Restart the libvirt and PolicyKit services for the changes to take effect:
    $ sudo systemctl restart libvirtd
    $ sudo systemctl restart polkit

    Note: If you get an error PolicyKit daemon disconnected from the bus. We are no longer a registered authentication agent., try $ systemctl status polkit, if the status is active (running), you can carry on with the installation.
  6. Add your user name to the vagrant group:
    $ sudo usermod -a -G vagrant

Installing and setting up CDK software components
Download Red Hat CDK from the Red Hat Developers website, install the plugins and add the CDK box to Vagrant.

  1. Download the CDK software components to your home directory. The following steps assume that these components have been downloaded in the ~/Downloads directory:
    • Red Hat Container Tools (cdk-2.2.0.zip)
    • Red Hat Enterprise Linux 7.2 Vagrant box for libvirt (rhel-cdk-kubernetes-7.2-*.x86_64.vagrant-libvirt.box or later)
  2. Unzip the ZIP file you downloaded in your home directory. This should create the ~/cdk subdirectory:
    $ cd
    $ unzip ~/Downloads/cdk-2.2.0.zip
  3. Install the vagrant plugins contained in the plugins directory:
    $ cd ~/cdk/plugins/
    $ vagrant plugin install \
    ./vagrant-registration-1.3.0.gem \
    ./vagrant-service-manager-1.3.3.gem \
    ./vagrant-sshfs-1.2.0.gem

    Note: If you use libvirt as your vagrant provider, and get a vagrant provider missing error, ensure that you have the provider plugin installed as follows:
    $ vagrant plugin install vagrant-libvirt
  4. Verify that all the vagrant plugins are installed by running:
    $ vagrant plugin list
    You should see the following output:
    vagrant-libvirt (0.0.32, system)
    vagrant-registration (1.3.1)
    - Version Constraint: 1.3.1
    vagrant-service-manager (1.4.1)
    - Version Constraint: 1.4.1
    vagrant-sshfs (1.2.1)
    - Version Constraint: 1.2.1

    Note: vagrant-libvirt would be displayed in the output, only if you have installed the vagrant-libvirt plugin.
  5. Add the CDK box to Vagrant with this command:
    $ vagrant box add --name cdkv2 ~/Downloads/rhel-cdk-kubernetes-7.2*.x86_64.vagrant-libvirt.box
    Verify that the box is installed by running the following command:
    $ vagrant box list

Starting CDK
Start the Vagrant box using a Vagrantfile. CDK provides you with Vagrantfiles for OpenShift and Kubernetes. The OpenShift (rhel-ose) Vagrantfile launches a VM with OpenShift Enterprise running on it.

  1. Navigate to the rhel-ose directory:
    $ cd ~/cdk/components/rhel/rhel-ose/
  2. Start CDK with OpenShift Container Platform setup as follows:
    $ vagrant up
    Note that, this returns a very helpful message with tips to access the OpenShift console and CLI.
  3. Enter your developers.redhat.com user credentials when prompted to register the Red Hat Enterprise Linux system running in the Vagrant VM.
  4. Verify that your Vagrant VM is running, to ensure you are ready to use CDK, as follows:
    $ vagrant status
    Note that, for this command to work, you need to be in the same directory where your Vagrantfile is located.

Ta da, you can now access the OpenShift console or use the OpenShift CLI to run a microservices based architecture on a stable platform.


Join the Red Hat Developer Program (it’s free) and get access to related cheat sheets, books, and product downloads.


For more information about Red Hat OpenShift and other related topics, visit: OpenShift, OpenShift Online.

Share
  • Thanks for the help, somehow can’t find this anywhere else.