{"id":284,"date":"2018-10-16T06:38:08","date_gmt":"2018-10-16T06:38:08","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw93\/?p=284"},"modified":"2018-10-16T09:53:50","modified_gmt":"2018-10-16T09:53:50","slug":"red-hat-container-development-kit-cdk-with-nested-kvm","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/10\/16\/red-hat-container-development-kit-cdk-with-nested-kvm\/","title":{"rendered":"Red Hat Container Development Kit (CDK) With Nested KVM"},"content":{"rendered":"<p>&nbsp;<\/p>\n<h2>Red Hat Container Development Kit (CDK) With Nested KVM<\/h2>\n<p>By\u00a0<a href=\"https:\/\/developers.redhat.com\/blog\/author\/fatherlinux\/\">Scott McCarty<\/a> February 13, 2018February 12, 2018<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/developers.redhat.com\/blog\/wp-content\/uploads\/2014\/08\/shadowman-solo-from-external-web-265x200-1.jpeg\" alt=\"\" width=\"265\" height=\"200\" \/><\/p>\n<h2>Why<\/h2>\n<p>If you are like me, you probably prefer to install new and exploratory software in a fresh virtual machine (VM) or container to insulate your laptop\/desktop from software pollution (TM). <a href=\"https:\/\/developers.redhat.com\/products\/cdk\/overview\/\">Red Hat Container Development Kit<\/a> (CDK) relies on virtualization to create a Red Hat Enterprise Linux (RHEL) virtual machine to run OpenShift (based on Kubernetes). Red Hat specifically supports installation of the CDK on <a href=\"https:\/\/developers.redhat.com\/products\/cdk\/hello-world\/#fndtn-windows\">Windows<\/a>, <a href=\"https:\/\/developers.redhat.com\/products\/cdk\/hello-world\/#fndtn-macos\">macOS<\/a>, and <a href=\"https:\/\/developers.redhat.com\/products\/cdk\/hello-world\/#fndtn-rhel\">RHEL Server<\/a>, but if you are running Fedora, RHEL Workstation, or even CentOS, you will run into trouble. If you are not running a supported desktop, you can always use a RHEL Server virtual machine, and this tutorial is for you.<\/p>\n<p>This tutorial is specific to running RHEL Server as a VM on RHEL Workstation, but these instructions should work for Fedora and CentOS. With a modification of the first step \u2013 creating a virtual machine with nested virtualization enabled (<a href=\"https:\/\/communities.vmware.com\/docs\/DOC-8970\">vmware<\/a>, <a href=\"https:\/\/docs.microsoft.com\/en-us\/virtualization\/hyper-v-on-windows\/user-guide\/nested-virtualization\">hyper-v<\/a>) \u2013 you should be able to make these instructions work on Windows and macOS as well.<\/p>\n<h2>How<\/h2>\n<h3>Create a Virtual Machine<\/h3>\n<p>First, create a new virtual machine and do a RHEL Server installation. Personally, I use virt-manager because it makes it easy to create ephemeral virtual machines for testing. I gave my VM 8192 MB of RAM, and 1 vCPU. While creating the VM, remember to configure the CPU to copy the host configuration. This will enable Nested KVM which will allow you to run virtual machines inside of your new virtual machine \u2013 mind\u2026.blown\u2026.<\/p>\n<p><a href=\"https:\/\/developers.redhat.com\/blog\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-08-56-19.png\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/blog\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-08-56-19.png\" alt=\"\" \/><\/a><\/p>\n<h3>Install RHEL<\/h3>\n<p><a href=\"https:\/\/access.redhat.com\/downloads\/content\/69\/ver=\/rhel---7\/7.5%20Beta\/x86_64\/product-software\">Download<\/a> and <a href=\"https:\/\/access.redhat.com\/documentation\/en-us\/red_hat_enterprise_linux\/7\/html\/installation_guide\/index\">install<\/a> RHEL Server, because that\u2019s one of the<a href=\"https:\/\/developers.redhat.com\/products\/cdk\/hello-world\/#fndtn-rhel\"> supported platforms for CDK<\/a>. I won\u2019t rewrite the instructions on this because most people can do this without documentation.<\/p>\n<p>On the new RHEL Installation, install and configure virtualization and a few other tools to make things easier:<\/p>\n<p>yum install -y qemu-kvm qemu-img libvirt virt-manager xauth firefox<\/p>\n<h3>Install CDK<\/h3>\n<p>In the newly created virtual machine <a href=\"https:\/\/developers.redhat.com\/products\/cdk\/hello-world\/#fndtn-rhel\">enable, download<\/a>, and <a href=\"https:\/\/access.redhat.com\/documentation\/en-us\/red_hat_container_development_kit\/3.2\/html-single\/getting_started_guide\/index#quickstart-overview\">install<\/a> CDK. Remember to:<\/p>\n<p>subscription-manager repos &#8211;enable rhel-7-server-devtools-rpms<br \/>\nsubscription-manager repos &#8211;enable rhel-server-rhscl-7-rpms<br \/>\ncd \/etc\/pki\/rpm-gpg<br \/>\nwget -O RPM-GPG-KEY-redhat-devel https:\/\/www.redhat.com\/security\/data\/a5787476.txt<br \/>\nrpm &#8211;import RPM-GPG-KEY-redhat-devel<br \/>\nyum install cdk-minishift docker-machine-kvm<\/p>\n<p>Now, setup the CDK. This will do everything for you, including putting the OC binary where it needs to be.<\/p>\n<p>ln -s \/root\/.minishift\/cache\/oc\/v3.7.14\/linux\/oc \/usr\/bin\/oc<br \/>\nminishift setup-cdk<br \/>\nminishift start<\/p>\n<h3>Up and Running<\/h3>\n<p>These are instructions usually missed by tutorials. Notice, the oc command is automatically configured to connect to the Kubernetes\/OpenShift environment in the virtual machine (which is inside the virtual machine you created \u2013 mic drop)<\/p>\n<p>oc get pods<br \/>\noc get pv<br \/>\noc get node<\/p>\n<p>You can also get directly into the CDK virtual, virtual machine by using the following command. From here you can run docker commands, look at underlying storage, etc:<\/p>\n<p>minishift ssh<br \/>\ndocker ps<br \/>\ndocker images<\/p>\n<p>Or, go into the browser console with this command. This will show you the OpenShift web console in a browser, displayed over X11 to your laptop (that\u2019s why we installed xauth). Warning, you have to disable SELinux:<\/p>\n<p>setenforce 0<br \/>\nminishift console<\/p>\n<p>Now, you have a fully functional OpenShift environment up and running, and you are ready explore just about any Kubernetes or OpenShift tutorial on the Internet. You even have persistent volumes set up for storage tests.<\/p>\n<h3>Tips &amp; Tricks<\/h3>\n<p>Tip: if the minishift setup fails, you can always delete and start again with:<\/p>\n<p>minishift delete<br \/>\nminishift cdk-setup<\/p>\n<p>Tip: Sometimes you have to manually delete the subscription on the Red Hat Portal so that you can run the CDK setup again. Just use the Remove System button:<\/p>\n<p><a href=\"https:\/\/developers.redhat.com\/blog\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-10-35-16.png\"><img decoding=\"async\" src=\"https:\/\/developers.redhat.com\/blog\/wp-content\/uploads\/2018\/02\/Screenshot-from-2018-02-09-10-35-16-1024x798.png\" alt=\"\" \/><\/a><\/p>\n<p>Tip: Since we are doing nested virtualization, every now and then you will end up with some funky network problems or other problems. Just, delete the CDK and reboot the virtual machine:<\/p>\n<p>minishift delete<br \/>\nreboot<\/p>\n<p>Take advantage of your Red Hat Developers membership and download RHEL today at no cost.<\/p>\n<p><a href=\"https:\/\/developers.redhat.com\/blog\/2018\/02\/13\/red-hat-cdk-nested-kvm\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Red Hat Container Development Kit (CDK) With Nested KVM By\u00a0Scott McCarty February 13, 2018February 12, 2018 Why If you are like me, you probably prefer to install new and exploratory software in a fresh virtual machine (VM) or container to insulate your laptop\/desktop from software pollution (TM). Red Hat Container Development Kit (CDK) relies &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/10\/16\/red-hat-container-development-kit-cdk-with-nested-kvm\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Red Hat Container Development Kit (CDK) With Nested KVM&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-284","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/comments?post=284"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/284\/revisions"}],"predecessor-version":[{"id":333,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/284\/revisions\/333"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/media?parent=284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/categories?post=284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/tags?post=284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}