{"id":11514,"date":"2017-07-12T15:14:41","date_gmt":"2017-07-12T13:14:41","guid":{"rendered":"https:\/\/blog.zhaw.ch\/icclab\/?p=11514"},"modified":"2017-07-12T15:14:41","modified_gmt":"2017-07-12T13:14:41","slug":"supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm","status":"publish","type":"post","link":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/","title":{"rendered":"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm"},"content":{"rendered":"<p><span style=\"font-weight: 400\">Rancher is a container management platform focused on delivering containers on any infrastructure. It has support for multiple environments which could make use of one of the multiple container orchestrators available (at the time of this writing) &#8211; Cattle, Kubernetes, Swarm and Mesos. In our <\/span><a href=\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher\/\"><span style=\"font-weight: 400\">previous blog post<\/span><\/a><span style=\"font-weight: 400\"> we showed how we built rancher-agent containers for arm64 systems in a Cattle environment. We made a few improvements since then, mostly on porting a Swarm environment to arm64, and these are documented in this blog post.<\/span><!--more--><\/p>\n<p><span style=\"font-weight: 400\">In our setup we had a Swarm environment that was configured to have a single manager, the manager was already set up in an x86 \u00a0virtual machine running in the cloud. We then only had to add arm64 workers to the swarm.<\/span><br \/>\n<i><span style=\"font-weight: 400\">Note that swarm-manager could also run on arm but we decided to use a vm on Openstack to make sure we have a heterogenous environment in Rancher.<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400\">Just like in a Cattle environment, a set of infrastructure containers are started after a host is created in a Swarm environment &#8211; <\/span><a href=\"https:\/\/github.com\/rancher\/healthcheck\"><span style=\"font-weight: 400\">healthcheck<\/span><\/a><span style=\"font-weight: 400\">, <\/span><a href=\"https:\/\/github.com\/rancher\/rancher-net\"><span style=\"font-weight: 400\">net<\/span><\/a><span style=\"font-weight: 400\">, <\/span><a href=\"https:\/\/github.com\/rancher\/rancher-dns\"><span style=\"font-weight: 400\">dns<\/span><\/a><span style=\"font-weight: 400\"> and <\/span><a href=\"https:\/\/github.com\/rancher\/plugin-manager\"><span style=\"font-weight: 400\">plugin-manager<\/span><\/a><span style=\"font-weight: 400\"> (network manager) &#8211; <\/span><span style=\"font-weight: 400\">there is one important additional container that\u2019s added on top of those, the <\/span><a href=\"https:\/\/github.com\/LLParse\/swarmkit-catalog\/tree\/master\/images\/swarm\"><span style=\"font-weight: 400\">swarmkit container<\/span><\/a><span style=\"font-weight: 400\">. Since most of the work was done a priori, we expected that it would be straightforward to build and run another image for arm64. The main issue we faced was not in building the swarmkit container image itself but in running it and joining the host to the Swarm cluster. As a result, once the container started at <\/span><a href=\"https:\/\/github.com\/LLParse\/swarmkit-catalog\/blob\/master\/images\/swarm\/run.sh\"><span style=\"font-weight: 400\">its entry point<\/span><\/a><span style=\"font-weight: 400\"> it attempted to join the Swarm, the swarm-manager received the request adding the host to the cluster, however it also immediately removed it.<\/span><\/p>\n<p><span style=\"font-weight: 400\">After a bit of investigation we found out that the swarm manager has a <\/span><a href=\"https:\/\/github.com\/LLParse\/swarmkit-catalog\/blob\/master\/images\/swarm\/run.sh#L207\"><span style=\"font-weight: 400\">function<\/span><\/a><span style=\"font-weight: 400\"> to remove nodes from the cluster whenever a host is removed from the environment. This function gets triggered immediately after the new host joined and the command <\/span><br \/>\n<code><span style=\"font-weight: 400\">docker node rm $id --force<\/span><\/code> was getting executed. It is still unclear why the new node that just joined the cluster was not considered part of it by the swarm-manager but after few modifications to the script we successfully managed to get a heterogeneous Swarm environment in Rancher!<\/p>\n<p><span style=\"font-weight: 400\">In order to use our <\/span><a href=\"https:\/\/hub.docker.com\/r\/icclab\/rancher-swarmkit\/\"><span style=\"font-weight: 400\">docker image<\/span><\/a><span style=\"font-weight: 400\"> you first need to do a modification in swarmkit-mon stack. \u00a0This stack has the option to always pull the image before creating the container &#8211; you need to deactivate that by unticking a tickbox and upgrading the stack. To do so you will need to select the Swarm stack under \u201cSwarm &gt; Infrastructure\u201d, there will be the option to upgrade the stack, you can also select the amount of managers you would like to deploy.<\/span><\/p>\n<p><span style=\"font-weight: 400\">After this you\u2019re good to go and you can start adding new heterogeneous hosts to your swarm cluster. <\/span><\/p>\n<p><span style=\"font-weight: 400\">One drawback of using a Swarm environment over Cattle is that Swarm does not support privileged containers, and this is crucial if there is any sensor data that needs to be accessed in the RPi. Although it does not support privileged containers, there is a <\/span><a href=\"https:\/\/blog.alexellis.io\/gpio-on-swarm\/\"><span style=\"font-weight: 400\">workaround that can be used to access the GPIO board with sysfs<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/p>\n<div class=\"pt-sm\">Schlagw\u00f6rter: <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/docker\/\">docker<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/rancher\/\">rancher<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/raspberry-pi\/\">raspberry pi<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/swarm\/\">swarm<\/a><br><\/div>","protected":false},"excerpt":{"rendered":"<p>Rancher is a container management platform focused on delivering containers on any infrastructure. It has support for multiple environments which could make use of one of the multiple container orchestrators available (at the time of this writing) &#8211; Cattle, Kubernetes, Swarm and Mesos. In our previous blog post we showed how we built rancher-agent containers [&hellip;]<\/p>\n","protected":false},"author":101,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[484,850,865,875],"features":[],"class_list":["post-11514","post","type-post","status-publish","format-standard","hentry","category-allgemein","tag-docker","tag-rancher","tag-raspberry-pi","tag-swarm"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm - Service Engineering (ICCLab &amp; SPLab)<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm\" \/>\n<meta property=\"og:description\" content=\"Rancher is a container management platform focused on delivering containers on any infrastructure. It has support for multiple environments which could make use of one of the multiple container orchestrators available (at the time of this writing) &#8211; Cattle, Kubernetes, Swarm and Mesos. In our previous blog post we showed how we built rancher-agent containers [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/\" \/>\n<meta property=\"og:site_name\" content=\"Service Engineering (ICCLab &amp; SPLab)\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-12T13:14:41+00:00\" \/>\n<meta name=\"author\" content=\"Bruno Grazioli\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bruno Grazioli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/\"},\"author\":{\"name\":\"Bruno Grazioli\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba\"},\"headline\":\"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm\",\"datePublished\":\"2017-07-12T13:14:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/\"},\"wordCount\":540,\"commentCount\":0,\"keywords\":[\"docker\",\"rancher\",\"raspberry pi\",\"swarm\"],\"articleSection\":[\"*.*\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/\",\"name\":\"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm - Service Engineering (ICCLab &amp; SPLab)\",\"isPartOf\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#website\"},\"datePublished\":\"2017-07-12T13:14:41+00:00\",\"author\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\/\/blog.zhaw.ch\/icclab\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#website\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/\",\"name\":\"Service Engineering (ICCLab &amp; SPLab)\",\"description\":\"A Blog of the ZHAW Zurich University of Applied Sciences\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.zhaw.ch\/icclab\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba\",\"name\":\"Bruno Grazioli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g\",\"caption\":\"Bruno Grazioli\"},\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/author\/gaea\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm - Service Engineering (ICCLab &amp; SPLab)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/","og_locale":"en_US","og_type":"article","og_title":"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm","og_description":"Rancher is a container management platform focused on delivering containers on any infrastructure. It has support for multiple environments which could make use of one of the multiple container orchestrators available (at the time of this writing) &#8211; Cattle, Kubernetes, Swarm and Mesos. In our previous blog post we showed how we built rancher-agent containers [&hellip;]","og_url":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/","og_site_name":"Service Engineering (ICCLab &amp; SPLab)","article_published_time":"2017-07-12T13:14:41+00:00","author":"Bruno Grazioli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Bruno Grazioli","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/#article","isPartOf":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/"},"author":{"name":"Bruno Grazioli","@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba"},"headline":"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm","datePublished":"2017-07-12T13:14:41+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/"},"wordCount":540,"commentCount":0,"keywords":["docker","rancher","raspberry pi","swarm"],"articleSection":["*.*"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/","url":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/","name":"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm - Service Engineering (ICCLab &amp; SPLab)","isPartOf":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/#website"},"datePublished":"2017-07-12T13:14:41+00:00","author":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba"},"breadcrumb":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.zhaw.ch\/icclab\/supporting-container-based-application-deployment-to-heterogeneous-hardware-using-rancher-and-swarm\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/blog.zhaw.ch\/icclab\/"},{"@type":"ListItem","position":2,"name":"Supporting Container based Application Deployment to Heterogeneous Hardware using Rancher and Swarm"}]},{"@type":"WebSite","@id":"https:\/\/blog.zhaw.ch\/icclab\/#website","url":"https:\/\/blog.zhaw.ch\/icclab\/","name":"Service Engineering (ICCLab &amp; SPLab)","description":"A Blog of the ZHAW Zurich University of Applied Sciences","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.zhaw.ch\/icclab\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba","name":"Bruno Grazioli","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g","caption":"Bruno Grazioli"},"url":"https:\/\/blog.zhaw.ch\/icclab\/author\/gaea\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/11514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/users\/101"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/comments?post=11514"}],"version-history":[{"count":4,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/11514\/revisions"}],"predecessor-version":[{"id":11518,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/11514\/revisions\/11518"}],"wp:attachment":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/media?parent=11514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/categories?post=11514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/tags?post=11514"},{"taxonomy":"features","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/features?post=11514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}