In simple words, Container Development Kit, or just CDK, is a platform that enable you to run Openshift locally. Openshift is a open source container platform created by Red Hat that relies in base container technologies like Docker and Kubernets.
The CDK installation procedure is not simple and varies according to the operating system used, in this post I’ll show how to install CDK in a Linux environment, most specifically in Fedora 25 operation system.
All you need to install are:
- Virtualization packages;
- Container Development Kit
- OCP client tools.
Docker is available in Fedora’s software packages repositories, so all you need to do to install is run the following command:
$ sudo dnf install -y docker
After the command completes, you need to enable and start Docker as a service:
$ sudo systemctl enable docker.service
$ sudo systemctl start docker.service
To see if the docker daemon is running:
$ sudo docker info
The docker installation varies from system to system, so, if you are not using Fedora distribution, check the Docker documentation to find out how to install it to your own system.
You need a virtualization tool to run Vagrant so you can run CDK. You can choose vmware, vitualbox or libvirt as you virtualization technology. In this post I choose libvirt, because the packages are already available in Fedora packages repositories. So to install libvirt in your host, just run the following commands:
$ sudo dnf install qemu libvirt libvirt-devel ruby-devel gcc qemu-kvm
You can have some problems with some ruby gems, like nokogiri and ruby-libvirt, so, to prevent that to happen, install these follow packages too:
$ sudo dnf install libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c ruby-devel gcc
Start and enable libvirt as a service:
$ systemctl start libvirtd
$ systemctl enable libvirtd
Vagrant is a tool for building and managing virtual machine environments in a single workflow. Theses tool is the right tool to simulate production environment in the developer machine.
To install it just run the command:
$ sudo dnf install -y vagrant
You need to install all Vagrant required plugins too:
$ sudo vagrant plugin install vagrant-libvirt vagrant-registration vagrant-service-manager vagrant-sshsf
To see if everything is okay with Vagrant:
$ vagrant global-status
Container Development Kit
All the previous steps were to arrive at this moment, but before we start to run the installation commands, you need to download Red Hat Container Tools and RHEL 7.3 for libvirt at Red Hat Developer Site CDK download page. In the time of this write, the current version are 2.4.
First thing is to install the RHEL 7.3 Vagrant Box at your machine:
vagrant box add --name cdkv2 rhel-cdk-kubernetes-7.*.x86_64.vagrant-libvirt.box
In the installation process, you’ll be prompt to inform your credentials to register RHEL. Just inform the credential that you create to access the Red Hat Developer Site.
To see if the box was installed:
vagrant box list
Now unzip the CDK file that you just downloaded in a directory that I’ll call $CDK_HOME. Change your working directory to:
$ cd $CDK_HOME/cdk/components/rhel/rhel-ose/
Now, the only thing that you need to do is to start the CDK Box:
$ vagrant up
Now you have a Openshift environment working in your local machine. 🙂
Go to this address to open the web console: https://10.1.2.2:8443/console
The preconfigured users are:
- User: openshift-dev Password: devel – to log as a developer;
- User: admin Password: admin – to log as a administrator.
OCP Client Tools
Finally, the last tool that you need to install is the oc client tool, so you can interact with Openshift from a terminal window. All you need to do is to use Vagrant to that. Just run:
$ vagrant service-manager install-cli openshift
Now you can login in Openshift:
$ oc login 10.1.2.2:8443
Have fun 😉