{"id":142,"date":"2020-10-26T14:22:07","date_gmt":"2020-10-26T13:22:07","guid":{"rendered":"https:\/\/www.cbulon.nl\/?p=142"},"modified":"2020-10-26T14:24:07","modified_gmt":"2020-10-26T13:24:07","slug":"how-to-install-a-test-openshift-container-platform","status":"publish","type":"post","link":"https:\/\/www.cbulon.nl\/?p=142","title":{"rendered":"How to install a test OpenShift Container Platform"},"content":{"rendered":"\n<p>RedHat OpenShift is the new platform to be! If you want to be ready for the future, you have to be on Red Hat OpenShift Container Platform. But how can you play with OpenShift? First thing I find on the web is <strong>Minishift<\/strong> or <strong>OKD<\/strong>. But both are only updated to (OpenShift) 3.11 and at the time of writing, OpenShift 4.6 is released. And of course we want to play with the latest versions \ud83d\ude42 Luckily Red Hat has given us more options.<\/p>\n\n\n\n<p>To try RedHat OpenShift, you can go to <a rel=\"noreferrer noopener\" href=\"https:\/\/www.openshift.com\/try\" target=\"_blank\">openshift.com\/try<\/a>.  Here you find 4 options.<br>1. On your computer<br>2. In your datacenter<br>3. In your public cloud<br>4. As-a-Service<br><br>The beste choice for me is 1 because a full installation of OpenShift requires a lot of resources which I do not have. I just want a minimal installation to test and play.<\/p>\n\n\n\n<p>When you choose for <strong>On your computer,<\/strong> you have to login with your Red Hat account. If you don&#8217;t have one, you can create it directly. <br>On the Red Hat website you can download CodeReady Containers (CRC), which can bring a minimal OpenShift cluster up and running on your local laptop or pc. CRC OpenShift cluster is a single node which behaves as both a master and worker node. All machine-config and monitoring Operators are disabled. That why it is to play and test only.<\/p>\n\n\n\n<p><strong>How to install?<\/strong><br>The hardware requirements for CRC are <br>&#8211; 4 vCPUs<br>&#8211; 9GB Memory<br>&#8211; 35GB Harddisk<br>As OS, you can choose for minimum Windows 10, MacOS Sierra or Linux RHEL\\CentOS 7.5 or Fedora (last 2 versions).<br>In my case, I install it on my virtual server (running on Proxmox) where I choose CentOS 8.2. I installed CentOS with 4 vCPUs, 10GB Memory and 50GB of Harddisk (bye bye resources).<\/p>\n\n\n\n<p>After CentOS is installed, you also need to install the Network Manager:<br><code># su -c 'yum install NetworkManager'<\/code><br>In my case, this was already installed during the basic setup.<\/p>\n\n\n\n<p>Next is to download and install CRC. The link can be found on the RedHat website. Choose Linux and check the link. Download the files to the Linux server. Please notice that the file is about 2.5GB big. Depending on your internet speed, this can take a while.<br><code># wget https:\/\/mirror.openshift.com\/pub\/openshift-v4\/clients\/crc\/latest\/crc-linux-amd64.tar.xz<\/code><\/p>\n\n\n\n<p>Unpack the downloaded file:<br><code># tar -xf crc-linux-amd64.tar.xz<\/code><\/p>\n\n\n\n<p>Move the CRC file to a path directory or add the directory to the path file. I choose for the move.  Check your path directories by running command<br><code># echo $PATH<\/code><\/p>\n\n\n\n<p>I move the file to \/usr\/local\/bin<br><code># sudo cp crc \/usr\/local\/bin\/<\/code><\/p>\n\n\n\n<p>Check if the installation was successful by checking the installed version<br><code># crc version<br><\/code><sub>CodeReady Containers version: 1.17.0+99f5c87<br>OpenShift version: 4.5.14 (embedded in binary)<\/sub><\/p>\n\n\n\n<p><strong>Start the setup of CRC<\/strong><br>This procedure will create the ~\/.crc directory if it does not already exist.<br><code># crc setup<br><\/code><sub>INFO Checking if oc binary is cached<br>INFO Caching oc binary<br>INFO Checking if podman remote binary is cached<br>INFO Checking if goodhosts binary is cached<br>INFO Caching goodhosts binary<br>INFO Will use root access: change ownership of \/home\/bjbaarssen\/.crc\/bin\/goodhosts<br>INFO Will use root access: set suid for \/home\/bjbaarssen\/.crc\/bin\/goodhosts<br>INFO Checking if CRC bundle is cached in &#8216;$HOME\/.crc&#8217;<br>INFO Unpacking bundle from the CRC binary<br>INFO Checking minimum RAM requirements<br>INFO Checking if running as non-root<br>INFO Checking if Virtualization is enabled<br>INFO Setting up virtualization<br>You need to enable virtualization in BIOS<\/sub><\/p>\n\n\n\n<p>By default, the settings in Proxmox for nested virtualization are disabled. Normally you are not virtualizing within your virtualization layer because it is much slower. At this point, I have not other solution, so I have to change my Proxmox settings.<\/p>\n\n\n\n<p><strong>Change Proxmox settings:<\/strong><br>Source: <a href=\"https:\/\/pve.proxmox.com\/wiki\/Nested_Virtualization\">https:\/\/pve.proxmox.com\/wiki\/Nested_Virtualization<\/a><br>Login into your Proxmox shell.<br>Check your virtualization settings:<br><code># cat \/sys\/module\/kvm_intel\/parameters\/nested<\/code><br>output is N<\/p>\n\n\n\n<p>Change the virtualization settings to Y<br># echo &#8220;options kvm-intel nested=Y&#8221; &gt; \/etc\/modprobe.d\/kvm-intel.conf<\/p>\n\n\n\n<p>This setting will be activated after your restart of the service.<br>Because lots of other virtual servers are running on Proxmox, I have to shutdown all my servers. The service can not be restarted when it is in use.<\/p>\n\n\n\n<p>After you shutdown all the servers, restart the service: <br># modprobe -r kvm_intel<br># modprobe kvm_intel<\/p>\n\n\n\n<p>Check if the new setting is active:<br># cat \/sys\/module\/kvm_intel\/parameters\/nested<br>output is Y<\/p>\n\n\n\n<p>Also for the CentOS, the hosts settings in Proxmox need to be changed.<br>Go to the CentOS settings, Hardware &#8211; Processors (or CPU) and change to TYPE to HOST.<br>See printscreen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1001\" height=\"560\" src=\"https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-13.00.26.png\" alt=\"\" class=\"wp-image-151\" srcset=\"https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-13.00.26.png 1001w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-13.00.26-300x168.png 300w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-13.00.26-768x430.png 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>Start VM(s)<\/p>\n\n\n\n<p><strong>Start the setup of CRC<\/strong> (second try)<br><code># crc setup<\/code><br><sub>INFO Checking if oc binary is cached<br>INFO Checking if podman remote binary is cached<br>INFO Checking if goodhosts binary is cached<br>INFO Checking if CRC bundle is cached in &#8216;$HOME\/.crc&#8217;<br>INFO Checking minimum RAM requirements<br>INFO Checking if running as non-root<br>INFO Checking if Virtualization is enabled<br>INFO Checking if KVM is enabled<br>INFO Checking if libvirt is installed<br>INFO Installing libvirt service and dependencies<br>INFO Will use root access: install virtualization related packages<\/sub><br><strong>[sudo] wachtwoord voor bjbaarssen:<\/strong><br><sub>INFO Checking if user is part of libvirt group<br>INFO Adding user to libvirt group<br>INFO Will use root access: add user to libvirt group<br>INFO Checking if libvirt daemon is running<br>INFO Checking if a supported libvirt version is installed<br>INFO Checking if crc-driver-libvirt is installed<br>INFO Installing crc-driver-libvirt<br>INFO Checking for obsolete crc-driver-libvirt<br>INFO Checking if libvirt &#8216;crc&#8217; network is available<br>INFO Setting up libvirt &#8216;crc&#8217; network<br>INFO Checking if libvirt &#8216;crc&#8217; network is active<br>INFO Starting libvirt &#8216;crc&#8217; network<br>INFO Checking if NetworkManager is installed<br>INFO Checking if NetworkManager service is running<br>INFO Checking if \/etc\/NetworkManager\/conf.d\/crc-nm-dnsmasq.conf exists<br>INFO Writing Network Manager config for crc<br>INFO Will use root access: write NetworkManager config in \/etc\/NetworkManager\/conf.d\/crc-nm-dnsmasq.conf<br>INFO Will use root access: Changing permission for \/etc\/NetworkManager\/conf.d\/crc-nm-dnsmasq.conf to 420<br>INFO Will use root access: executing systemctl daemon-reload command<br>INFO Will use root access: executing systemctl reload NetworkManager<br>INFO Checking if \/etc\/NetworkManager\/dnsmasq.d\/crc.conf exists<br>INFO Writing dnsmasq config for crc<br>INFO Will use root access: write dnsmasq configuration in \/etc\/NetworkManager\/dnsmasq.d\/crc.conf<br>INFO Will use root access: Changing permission for \/etc\/NetworkManager\/dnsmasq.d\/crc.conf to 420<br>INFO Will use root access: executing systemctl daemon-reload command<br>INFO Will use root access: executing systemctl reload NetworkManager<\/sub><br><strong>Setup is complete, you can now run &#8216;crc start&#8217; to start the OpenShift cluster<\/strong><\/p>\n\n\n\n<p><strong>Start the OpenShift cluster<br><\/strong><code># crc start<br><\/code><sub>INFO Checking if oc binary is cached<br>INFO Checking if podman remote binary is cached<br>INFO Checking if goodhosts binary is cached<br>INFO Checking minimum RAM requirements<br>INFO Checking if running as non-root<br>INFO Checking if Virtualization is enabled<br>INFO Checking if KVM is enabled<br>INFO Checking if libvirt is installed<br>INFO Checking if user is part of libvirt group<br>INFO Checking if libvirt daemon is running<br>INFO Checking if a supported libvirt version is installed<br>INFO Checking if crc-driver-libvirt is installed<br>INFO Checking if libvirt &#8216;crc&#8217; network is available<br>INFO Checking if libvirt &#8216;crc&#8217; network is active<br>INFO Checking if NetworkManager is installed<br>INFO Checking if NetworkManager service is running<br>INFO Checking if \/etc\/NetworkManager\/conf.d\/crc-nm-dnsmasq.conf exists<br>INFO Checking if \/etc\/NetworkManager\/dnsmasq.d\/crc.conf exists<br>? Image pull secret [? for help]<\/sub><\/p>\n\n\n\n<p>Copy the pull secret from your <a href=\"https:\/\/cloud.redhat.com\/openshift\/install\/crc\/installer-provisioned\" target=\"_blank\" rel=\"noreferrer noopener\">Red Hat account<\/a> (see printscreen) and paste on the CLI and press Enter<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"892\" height=\"576\" src=\"https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-13.04.37.png\" alt=\"\" class=\"wp-image-153\" srcset=\"https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-13.04.37.png 892w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-13.04.37-300x194.png 300w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-13.04.37-768x496.png 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p><sub>INFO Extracting bundle: crc_libvirt_4.5.14.crcbundle &#8230; crc.qcow2: 9.97 GiB [&#8212;] 100.00%<br>INFO Checking size of the disk image \/home\/bjbaarssen\/.crc\/cache\/crc_libvirt_4.5.14\/&#8230;<br>INFO Creating CodeReady Containers VM for OpenShift 4.5.14&#8230; <br>INFO CodeReady Containers VM is running &nbsp; &nbsp; <br>INFO Generating new SSH Key pair &#8230;&nbsp; <br>INFO Copying kubeconfig file to instance dir &#8230;&nbsp; <br>INFO Starting network time synchronization in CodeReady Containers VM <br>INFO Verifying validity of the cluster certificates &#8230; <br>INFO Check internal and public DNS query &#8230;&nbsp; &nbsp; <br>INFO Check DNS query from host &#8230;&nbsp; &nbsp;<br>INFO Starting OpenShift kubelet service &nbsp; <br>INFO Configuring cluster for first start&nbsp; &nbsp;<br>INFO Adding user&#8217;s pull secret &#8230;&nbsp; &nbsp; &nbsp;<br>INFO Updating cluster ID &#8230; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>INFO Starting OpenShift cluster<br>INFO Updating kubeconfig<br>WARN The cluster might report a degraded or error state. This is expected since several operators have been disabled to lower the resource usage. For more information, please consult the documentation <em>Started the OpenShift cluster<\/em>.<br>To access the cluster, first set up your environment by following &#8216;crc oc-env&#8217; instructions.Then you can access it by running &#8216;oc login -u developer -p developer https:\/\/api.crc.testing:6443&#8217;.<br>To login as an admin, run &#8216;oc login -u kubeadmin -p dpDFV-xamBW-kKAk3-Fi6Lg https:\/\/api.crc.testing:6443&#8217;.***<br>To access the cluster, first set up your environment by following &#8216;crc oc-env&#8217; instructions.<\/sub><\/p>\n\n\n\n<p>Check the status of your CRC Cluster<br><code># crc status<br><\/code><sub>CRC VM: Running<br>OpenShift: Running (v4.5.14)<br>Disk Usage: 13.8GB of 32.72GB (Inside the CRC VM)<br>Cache Usage: 13.04GB<br>Cache Directory: \/home\/bjbaarssen\/.crc\/cache<\/sub><\/p>\n\n\n\n<p>To open the OpenShift webconsole, run the command<br><code># crc console<\/code><br>This will open your default webbrowser and start the OpenShift Web Console.<br>If something is going wrong, you get this error:<br><sub>Opening the OpenShift Web Console in the default browser\u2026[bjbaarssen@192 ~]$ Error: no DISPLAY environment variable specified<\/sub><\/p>\n\n\n\n<p>You can also request the URL also by<br><code># crc console --url<\/code><br><sub>https:\/\/console-openshift-console.apps-crc.testing<\/sub><\/p>\n\n\n\n<p>If you forgot the login credentials, you can run<br><code># crc console --credentials<br><\/code><sub>To login as a regular user, run &#8216;oc login -u developer -p developer https:\/\/api.crc.testing:6443&#8217;.<br>To login as an admin, run &#8216;oc login -u kubeadmin -p dpDFV-xamBW-kKAk3-Fi6Lg https:\/\/api.crc.testing:6443&#8217;<\/sub><\/p>\n\n\n\n<p>When you successfully run the command and logged into the Web Console, you can start with your first project. See printscreen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"510\" src=\"https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-11.06.21-1024x510.png\" alt=\"\" class=\"wp-image-146\" srcset=\"https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-11.06.21-1024x510.png 1024w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-11.06.21-300x149.png 300w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-11.06.21-768x382.png 768w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-11.06.21.png 1384w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>From this point we can open the OpenShift Web Console only on the Virtual Linux machine, but I want to open it on all my machines in my network. Let&#8217;s see how we can do that.<\/p>\n\n\n\n<p><strong>Setting up CodeReady Containers on a remote server<\/strong><\/p>\n\n\n\n<p>Be sure the cluster is running, check with <br><code># crc status<\/code><br>if down\/stopped, run<br><code># crc start<\/code><\/p>\n\n\n\n<p>Install the haproxy package and other utilities<br><code># sudo dnf install haproxy policycoreutils-python-utils jq<\/code><\/p>\n\n\n\n<p>Modify the firewall to allow communication with the cluster:<br><code># sudo systemctl start firewalld<br># sudo firewall-cmd --add-port=80\/tcp --permanent<br># sudo firewall-cmd --add-port=6443\/tcp --permanent <br># sudo firewall-cmd --add-port=443\/tcp --permanent <br># sudo systemctl restart firewalld<\/code><\/p>\n\n\n\n<p>For SELinux, allow listening to TCP port 6443<br><code># sudo semanage port -a -t http_port_t -p tcp 6443<\/code><\/p>\n\n\n\n<p>Create a backup of the default haproxy configuration in case you messed it up: <br><code># sudo cp \/etc\/haproxy\/haproxy.cfg{,.bak}<\/code><\/p>\n\n\n\n<p>Configure haproxy for use with the cluster:<br><code># export CRC_IP=$(crc ip)<br># sudo nano \/etc\/haproxy\/haproxy.cfg<\/code><br>Add the following to the cfg file:<br><code>global<br>  debug<br><br>defaults<br>  log global<br>  mode http<br>  timeout connect 5000<br>  timeout client 5000<br>  timeout server 5000<br><br>frontend apps<br>  bind 0.0.0.0:80<br>  bind 0.0.0.0:443 <br>  option tcplog <br>  mode tcp <br>  default_backend apps<br><br>backend apps<br>  mode tcp<br>  balance roundrobin<br>  option ssl-hello-chk<br>  server webserver1 $CRC_IP:443 check<br><br>frontend api<br>  bind 0.0.0.0:6443 <br>  option tcplog<br>  mode tcp <br>  default_backend api<br><br>backend api<br>  mode tcp<br>  balance roundrobin<br>  option ssl-hello-chk<br>  server webserver1 $CRC_IP:6443 check<\/code><\/p>\n\n\n\n<p>Start the haproxy service:<br><code># sudo systemctl start haproxy<\/code><\/p>\n\n\n\n<p>To open the OpenShift Web Console on your local clients in your network, add the following to their local hosts file. In my case, 192.168.1.64 is the ip address of the server where CRC is running.<br><code># sudo nano \/etc\/hosts<\/code><br>Add the following to the hosts file<br><code>192.168.1.64 api.crc.testing oauth-openshift.apps-crc.testing console-openshift-console.apps-crc.testing default-route-openshift-image-registry.apps-crc.testing<\/code><\/p>\n\n\n\n<p>Open a webbrowser on you client and go to <br><a href=\"https:\/\/console-openshift-console.apps-crc.testing\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/console-openshift-console.apps-crc.testing<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"615\" src=\"https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-12.36.44-1024x615.png\" alt=\"\" class=\"wp-image-149\" srcset=\"https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-12.36.44-1024x615.png 1024w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-12.36.44-300x180.png 300w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-12.36.44-768x461.png 768w, https:\/\/www.cbulon.nl\/wp-content\/uploads\/2020\/10\/Schermafbeelding-2020-10-26-om-12.36.44.png 1129w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>You probably don&#8217;t see any new blog online soon, because I am playing in Red Hat OpenShift Container Platform \ud83d\ude42<\/p>\n\n\n\n<p>Because this will eat a lot of your resources, you can easily temporally shutdown your CRC cluster and start it when you need it. See below the most common commands.<br><code># crc stop<br># crc status<br># crc start<br># crc console<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>RedHat OpenShift is the new platform to be! If you want to be ready for the future, you have to be on Red Hat OpenShift Container Platform. But how can you play with OpenShift? First thing I find on the web is Minishift or OKD. But both are only updated to (OpenShift) 3.11 and at &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.cbulon.nl\/?p=142\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;How to install a test OpenShift Container Platform&#8221;<\/span> verder lezen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[9,11,5,12,6,10,8,7],"_links":{"self":[{"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=\/wp\/v2\/posts\/142"}],"collection":[{"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=142"}],"version-history":[{"count":10,"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=\/wp\/v2\/posts\/142\/revisions"}],"predecessor-version":[{"id":156,"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=\/wp\/v2\/posts\/142\/revisions\/156"}],"wp:attachment":[{"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cbulon.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}