{"id":710,"date":"2018-01-05T13:38:00","date_gmt":"2018-01-05T12:38:00","guid":{"rendered":"https:\/\/blog.unetresgrossebite.com\/?p=710"},"modified":"2018-09-02T19:09:53","modified_gmt":"2018-09-02T17:09:53","slug":"openshift","status":"publish","type":"post","link":"https:\/\/blog.unetresgrossebite.com\/?p=710","title":{"rendered":"OpenShift"},"content":{"rendered":"<p>As of late 2017, I got introduced to OpenShift. Even though I&#8217;ve only been playing with a few basic features, nesting Docker into static KVMs,\u00a0 I was pretty impressed by the simplicity of services deployment, as served to end-users.<\/p>\n<div id=\"attachment_722\" style=\"width: 235px\" class=\"wp-caption alignright\"><a href=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/smallback-e1515265835587.jpg\"><img aria-describedby=\"caption-attachment-722\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-722\" src=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/smallback-e1515265835587-225x300.jpg\" alt=\"After replacing 4x MicroServer, by 3x SE318m1\" width=\"225\" height=\"300\" srcset=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/smallback-e1515265835587-225x300.jpg 225w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/smallback-e1515265835587-768x1024.jpg 768w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/smallback-e1515265835587.jpg 1134w\" sizes=\"(max-width: 225px) 100vw, 225px\" \/><\/a><p id=\"caption-attachment-722\" class=\"wp-caption-text\">After replacing 4x MicroServer, by 3x SE318m1<\/p><\/div>\n<p>I&#8217;ve first tried setting my own, re-using my ProLian MicroServers. One of my master node was refusing to deploy, CPU usage averaging around 100%, systemctl consistently timing out while starting some process &#8211; that did start on my two other master nodes.<br \/>\nAfter trying to resize my KVMs in vain, I eventually went another way: shut down a stair of ProLian MicroServer, move them out of my rack and plug instead 3 servers I ordered a couple years ago, that never reached prod &#8211; due to doubts regarding overall power consumption, EDF being able to deliver enough Amperes, my switches not being able to provide with enough LACP channels, my not having enough SSDs or quad-port Ethernet cards in stock to fill these servers,\u00a0 &#8230;<\/p>\n<p>I eventually compromised, and harvested any 500G SSDs disks available out of my Ceph cluster, mounting one per 1U server.<\/p>\n<p>Final setup involves the following physical servers:<\/p>\n<ul>\n<li>a custom tower (core i5, 32G DDR, 128G SSD disk)<\/li>\n<li>\n<div class=\"gmail_default\">3x HP SE316M1 (2xE5520, 24G DDR) &#8211; 500G SSD<\/div>\n<\/li>\n<li>\n<div class=\"gmail_default\">2x HP SE1102 (2xE5420 12G DDR) &#8211; 500G SSD<\/div>\n<\/li>\n<li>\n<div class=\"gmail_default\">3x ProLian MicroServer G5 (Turion, 4-8G DDR) &#8211; 64G SSD + 3&#215;3-4T HDD<\/div>\n<\/li>\n<\/ul>\n<p>And on top of these, a set of KVM instances, including:<\/p>\n<ul>\n<li>3 master nodes (2 CPU, 8G RAM)<\/li>\n<li>3 infra nodes (2 CPU, 6G RAM)<\/li>\n<li>3 compute nodes (4 CPU, 10G RAM @SE316M1)<\/li>\n<li>3 storage nodes (1 CPU, 3G RAM @MicroServer)<\/li>\n<\/ul>\n<p>Everything running on CentOS7. Except for some Ansible DomU I would use deploying OpenShift, running Debian Stretch.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/github.com\/openshift\/openshift-ansible\">OpenShift can be deployed using Ansible<\/a>. And as I&#8217;ve been writing my own roles for the past couple years, I can testify these ones are amazing.<\/p>\n<div id=\"attachment_719\" style=\"width: 310px\" class=\"wp-caption alignright\"><a href=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-glusterfs2.png\"><img aria-describedby=\"caption-attachment-719\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-719\" src=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-glusterfs2-300x192.png\" alt=\"GlusterFS @OpenShift\" width=\"300\" height=\"192\" srcset=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-glusterfs2-300x192.png 300w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-glusterfs2-768x491.png 768w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-glusterfs2.png 991w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-719\" class=\"wp-caption-text\">GlusterFS @OpenShift<\/p><\/div>\n<p>First ansible run would be done setting the following variables, bootstrapping service on top of my existing domain name, and LDAP server.<\/p>\n<blockquote><p>ansible_ssh_user: root<br \/>\nopenshift_deployment_type: origin<br \/>\nopenshift_disable_check: disk_availability,docker_storage,memory_availability<br \/>\nopenshift_master_cluster_method: native<br \/>\nopenshift_master_cluster_hostname: openshift.intra.unetresgrossebite.com<br \/>\nopenshift_master_cluster_public_hostname: openshift.intra.unetresgrossebite.com<br \/>\nopenshift_master_default_subdomain: router.intra.unetresgrossebite.com<br \/>\nopenshift.common.dns_domain: openshift.intra.unetresgrossebite.com<br \/>\nopenshift_clock_enabled: True<br \/>\nopenshift_node_kubelet_args: {&#8216;pods-per-core&#8217;: [&#8217;10&#8217;], &#8216;max-pods&#8217;: [&#8216;250&#8217;], &#8216;image-gc-high-threshold&#8217;: [&#8217;90&#8217;], &#8216;image-gc-low-threshold&#8217;: [&#8217;80&#8217;]}<br \/>\nopenshift_master_identity_providers:<br \/>\n&#8211; name: UneTresGrosseBite<br \/>\n&nbsp;&nbsp;challenge: &#8216;true&#8217;<br \/>\n&nbsp;&nbsp;login: &#8216;true&#8217;<br \/>\n&nbsp;&nbsp;kind: LDAPPasswordIdentityProvider<br \/>\n&nbsp;&nbsp;attributes:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;id: [&#8216;dn&#8217;]<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;email: [&#8216;mail&#8217;]<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;name: [&#8216;sn&#8217;]<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;preferredUsername: [&#8216;uid&#8217;]<br \/>\n&nbsp;&nbsp;bindDN: cn=openshift,ou=services,dc=unetresgrossebite,dc=com<br \/>\n&nbsp;&nbsp;bindPassword: secret<br \/>\n&nbsp;&nbsp;ca: ldap-chain.crt<br \/>\n&nbsp;&nbsp;insecure: &#8216;false&#8217;<br \/>\n&nbsp;&nbsp;url: &#8216;ldaps:\/\/netserv.vms.intra.unetresgrossebite.com\/ou=users,dc=unetresgrossebite,dc=com?uid?sub?(&amp;(objectClass=inetOrgPerson)(!(pwdAccountLockedTime=*)))&#8217;<br \/>\nopenshift_master_ldap_ca_file: \/root\/ldap-chain.crt<\/p><\/blockquote>\n<p>Setting up glusterfs, note you may have difficulties setting gluster block devices as group vars, and could find a solution sticking to defining these directly into your inventory file:<\/p>\n<blockquote><p>[glusterfs]<br \/>\ngluster1.friends.intra.unetresgrossebite.com glusterfs_ip=10.42.253.100 glusterfs_devices='[ &#8220;\/dev\/vdb&#8221;, &#8220;\/dev\/vdc&#8221;, &#8220;\/dev\/vdd&#8221; ]&#8217;<br \/>\ngluster2.friends.intra.unetresgrossebite.com glusterfs_ip=10.42.253.101 glusterfs_devices='[ &#8220;\/dev\/vdb&#8221;, &#8220;\/dev\/vdc&#8221;, &#8220;\/dev\/vdd&#8221; ]&#8217;<br \/>\ngluster3.friends.intra.unetresgrossebite.com glusterfs_ip=10.42.253.102 glusterfs_devices='[ &#8220;\/dev\/vdb&#8221;, &#8220;\/dev\/vdc&#8221;, &#8220;\/dev\/vdd&#8221; ]&#8217;<\/p><\/blockquote>\n<p>Apply the main playbook with:<\/p>\n<blockquote><p>ansible-playbook playbooks\/byo\/config.yml -i .\/hosts<\/p><\/blockquote>\n<p>Have a break: with 4 CPUs &amp; 8G RAM on my ansible host, applying a single variable change (pretty much everything was installed beforehand), I would still need over an hour and a half applying the full playbook:\u00a0whenever possible, stick to whatever service-specific playbook you may find, &#8230;<\/p>\n<div id=\"attachment_712\" style=\"width: 262px\" class=\"wp-caption alignright\"><a href=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-jenkins.png\"><img aria-describedby=\"caption-attachment-712\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-712\" src=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-jenkins-252x300.png\" alt=\"Jenkins @OpenShift\" width=\"252\" height=\"300\" srcset=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-jenkins-252x300.png 252w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-jenkins.png 535w\" sizes=\"(max-width: 252px) 100vw, 252px\" \/><\/a><p id=\"caption-attachment-712\" class=\"wp-caption-text\">Jenkins @OpenShift<\/p><\/div>\n<p>As a sidenote, be careful to properly set your domain name before deploying glusterfs. So far, while I was able to update my domain name almost everywhere running Ansible playbooks back, GlusterFS&#8217;s hekiti route was the first I noticed not being renamed.<br \/>\nShould you fuck up your setup, you can use <em>oc project glusterfs<\/em> then <em>oc get pods<\/em> to locate your running containers, use <em>oc rsh &lt;container&gt;<\/em> then <em>rm -fr \/var\/lib\/hekiti<\/em> to purge stuff that may prevent further deployments, &#8230;<br \/>\nThen\u00a0<em>oc delete project glusterfs<\/em>, to purge almost everything else.<br \/>\nYou may also use running\u00a0<em>docker images | grep gluster<\/em> and <em>docker rmi &lt;images&gt;<\/em>, &#8230; As well as making sure to wipe the first sectors of your gluster disks (<em>for d in b c d; do dd if=\/dev\/zero of=\/dev\/vd$d bs=1M count=8; done<\/em>). You may need to reboot your hosts (if a <em>wipefs -a \/dev\/drive<\/em> returns with an error). Finally, re-deploy a new GlusterFS cluster from scratch using Ansible.<\/p>\n<p>&nbsp;<\/p>\n<p>Once done with the main playbook, you should be able to log into your OpenShift dashboard. Test it by deploying Jenkins.<\/p>\n<div id=\"attachment_716\" style=\"width: 310px\" class=\"wp-caption alignleft\"><a href=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/openshift-hawkular.png\"><img aria-describedby=\"caption-attachment-716\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-716\" src=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/openshift-hawkular-300x90.png\" alt=\"hawkular @OpenShift\" width=\"300\" height=\"90\" srcset=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/openshift-hawkular-300x90.png 300w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/openshift-hawkular-768x230.png 768w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/openshift-hawkular-1024x307.png 1024w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/openshift-hawkular.png 1366w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-716\" class=\"wp-caption-text\">Hawkular integration @OpenShift<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>You could (should) also look into deploying OpenShift cluster metrics collection, based on Hawkular &amp; Heapster.<br \/>\nSticking with volatile storage, you would need adding the following variable to all your hosts:<\/p>\n<p>&nbsp;<\/p>\n<blockquote><p>openshift_metrics_install_metrics: True<\/p><\/blockquote>\n<p>Note to deploy these roles, you would have to install on your Ansible host (manually!) <em>python-passlib<\/em>, <em>apache2-utils<\/em> and\u00a0<em>openjdk-8-jdk-headless<\/em> (assuming Debian\/Ubuntu). You may then deploy metrics using the\u00a0<em>playbooks\/byo\/openshift-cluster\/openshift-metrics.yml<\/em> playbook.<\/p>\n<p>Hawkular integration would allow you to track resources usage directly from OpenShift dashboard.<\/p>\n<div id=\"attachment_721\" style=\"width: 310px\" class=\"wp-caption alignright\"><a href=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-prometheus.png\"><img aria-describedby=\"caption-attachment-721\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-721\" src=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-prometheus-300x145.png\" alt=\"Prometheus @OpenShift\" width=\"300\" height=\"145\" srcset=\"https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-prometheus-300x145.png 300w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-prometheus-768x370.png 768w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-prometheus-1024x494.png 1024w, https:\/\/blog.unetresgrossebite.com\/wp-content\/uploads\/2018\/01\/oshift-prometheus.png 1344w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-721\" class=\"wp-caption-text\">Prometheus @OpenShift<\/p><\/div>\n<p>You could also setup Prometheus defining the following:<\/p>\n<blockquote><p>openshift_prometheus_namespace: openshift-metrics<br \/>\nopenshift_prometheus_node_selector: {&#8220;region&#8221;:&#8221;infra&#8221;}<\/p><\/blockquote>\n<p>And applying the\u00a0<em>playbooks\/byo\/openshift-cluster\/openshift-prometheus.yml<\/em> playbook.<\/p>\n<p>&nbsp;<\/p>\n<p>You should also be able to setup some kind of centralized logging based on ElasticSearch, Kibana &amp; Fluentd, using the following:<\/p>\n<blockquote><p>openshift_logging_install_logging: True<br \/>\nopenshift_logging_kibana_hostname: kibana.router.intra.unetresgrossebite.com<br \/>\nopenshift_logging_es_memory_limit: 4Gi<br \/>\nopenshift_logging_storage_kind: dynamic<br \/>\nopenshift_cloudprovider_kind: glusterfs<\/p><\/blockquote>\n<p>Although so far, I wasn&#8217;t able to get it running properly ElasticSearch health is stuck to yellow, while Kibana and Fluentd can&#8217;t reach it somehow, could be due to a missing DNS record.<\/p>\n<p>&nbsp;<\/p>\n<p>From there, you would find plenty solutions, packaged for OpenShift, ready to deploy (a popular one seems to be\u00a0<a href=\"https:\/\/hub.docker.com\/r\/openshiftdemos\/gogs\/\" target=\"_blank\" rel=\"noopener\">Go Git Server<\/a>).<br \/>\nDeploying new services can still be a little painful, although there&#8217;s no denying OpenShift offers with a potentially amazing SAAS toolbox.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As of late 2017, I got introduced to OpenShift. Even though I&#8217;ve only been playing with a few basic features, nesting Docker into static KVMs,\u00a0 I was pretty impressed by the simplicity of services deployment, as served to end-users. I&#8217;ve first tried setting my own, re-using my ProLian MicroServers. One of my master node was [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,10,13,6,2],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts\/710"}],"collection":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=710"}],"version-history":[{"count":20,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts\/710\/revisions"}],"predecessor-version":[{"id":737,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts\/710\/revisions\/737"}],"wp:attachment":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}