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.
- Install KVM and libvirt:
$ sudo dnf install @Virtualization
- Launch the libvirt daemon and configure it to start at boot:
$ sudo systemctl start libvirtd
$ sudo systemctl enable libvirtd - Install Vagrant and the other required vagrant-libvirt plugins:
$ sudo dnf install vagrant vagrant-libvirt vagrant-libvirt-doc vagrant-registration rubygem-ruby-libvirt
- 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. - 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 errorPolicyKit daemon disconnected from the bus. We are no longer a registered authentication agent.
, try$ systemctl status polkit
, if the status isactive (running)
, you can carry on with the installation. - 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.
- 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)
- Unzip the ZIP file you downloaded in your home directory. This should create the
~/cdk
subdirectory:
$ cd
$ unzip ~/Downloads/cdk-2.2.0.zip - 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 uselibvirt
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
- 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. - 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.
- Navigate to the
rhel-ose
directory:
$ cd ~/cdk/components/rhel/rhel-ose/
- 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. - Enter your developers.redhat.com user credentials when prompted to register the Red Hat Enterprise Linux system running in the Vagrant VM.
- 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.
Last updated: March 22, 2023