{"id":455,"date":"2020-05-23T23:12:42","date_gmt":"2020-05-23T15:12:42","guid":{"rendered":"https:\/\/codestrian.com\/?p=455"},"modified":"2020-06-19T22:17:39","modified_gmt":"2020-06-19T14:17:39","slug":"ubuntu-20-04-rancher-and-raspberry-pi","status":"publish","type":"post","link":"https:\/\/codestrian.com\/index.php\/2020\/05\/23\/ubuntu-20-04-rancher-and-raspberry-pi\/","title":{"rendered":"Ubuntu 20.04, Rancher and Raspberry Pi"},"content":{"rendered":"<div>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/RPi-Logo-SCREEN.png\" width=\"120\" height=\"150\"\/><img decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/rancher.png\"\/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/ubuntu_focal.png\" width=\"150\" height=\"150\"\/>\n<\/div>\n<hr \/>\n<p>It has been a while since I purchased my Raspberry Pi 4. There was not much success in my previous attempts in getting rancher to run. The reason is due to incompatibility between Raspbian and Rancher. With the release of Ubuntu 20.04 LTS last month, I decided to try to explore setting up pi cluster again, but using Ubuntu this time.<br \/>\nAnd here it is! A guide to set up everything.<\/p>\n<p><strong>If you encountered any issues, do refer to the FAQ below.<\/strong><\/p>\n<h4>Hardware used in this guide<\/h4>\n<ol>\n<li>4 X Raspberry Pi 4B 4G <\/li>\n<li>1 X Debian Machine (this is used to run Rancher Server)<\/li>\n<\/ol>\n<h4>The Steps<\/h4>\n<p>Follow the guide below on how to install Ubuntu 20.04 onto Raspberry Pi.<br \/>\n<a href=\"https:\/\/ubuntu.com\/tutorials\/how-to-install-ubuntu-on-your-raspberry-pi#1-overview\" title=\"Install Ubuntu on Raspberry Pi 4\">Install Ubuntu on Raspberry Pi 4<\/a><\/p>\n<p>Add the following to \/boot\/firmware\/cmdline.txt<\/p>\n<pre><code>cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1<\/code><\/pre>\n<p>check that cgroup memory and cpuset are being enabled<\/p>\n<pre><code>$ cat \/proc\/cgroups\n#subsys_name    hierarchy       num_cgroups     enabled\ncpuset  2       10      1\ncpu     7       51      1\ncpuacct 7       51      1\nblkio   11      51      1\nmemory  4       114     1\ndevices 9       51      1\nfreezer 3       11      1\nnet_cls 6       10      1\nperf_event      5       10      1\nnet_prio        6       10      1\npids    10      56      1\nrdma    8       2       1<\/code><\/pre>\n<p>Change the hostname so that each raspberry pi has an unique identifier<\/p>\n<pre><code>$ sudo vim \/etc\/hostname<\/code><\/pre>\n<p>I have named mine, rpi-1 to rpi-4<\/p>\n<hr \/>\n<p>Install Docker onto all the machines. You may follow the guide from docker hub below.<br \/>\n<a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\">Docker Installation Guide<\/a><\/p>\n<p>After docker has been installed, run the following command to launch Rancher Server (For performance reason, this is preferrably done on a dedicated machine other than raspberry pi)<\/p>\n<pre><code>$ docker run -d --restart=unless-stopped -p 8080:80 -p 8443:443 rancher\/rancher:v2.3.5<\/code><\/pre>\n<p>Once your rancher server has successfully launched, open your browser and enter https:\/\/&lt;your.ip>:8443\/<br \/>\n<strong>WARNING: Do not use localhost or 127.0.0.1. If you did use that to open the page, please use your host ip for the URL when prompted to be saved.<\/strong><br \/>\n<img decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/dash.png\" alt=\"dash\" \/><br \/>\nClick on <strong>Add Cluster<\/strong> and select <strong>From existing nodes (Custom)<\/strong><br \/>\n<img decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/add_cluster.png\" alt=\"add_cluster\" \/><br \/>\nSelect <strong>Flannel<\/strong> under network provider and leave everything as default.<br \/>\n<img decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/cluster_option.png\" alt=\"add_cluster\" \/><br \/>\nClick Next to add an etcd and controlplane. <strong>WARNING: DO NOT ADD WORKER YET<\/strong><br \/>\n<img decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/add_node.png\" alt=\"nodes\" \/><br \/>\nAfter the cluster has been successfully created, you will see something similar to the screenshot below.<br \/>\n<img decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/cluster1.png\" alt=\"nodes\" \/><br \/>\nNext, let's add the worker nodes. This step may take a while and you will probably notice this error in your rancher server container log. This is perfectly normal. It will not impact the addition of worker nodes.<\/p>\n<pre><code>2020\/05\/23 14:07:43 [INFO] Handling backend connection request [c-qsxwk:m-656930d379e4]\nE0523 14:08:05.982836       7 reflector.go:280] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to watch *v3.ClusterAuthToken: Get https:\/\/192.168.3.122:6443\/apis\/cluster.cattle.io\/v3\/watch\/namespaces\/cattle-system\/clusterauthtokens?allowWatchBookmarks=true&amp;resourceVersion=920&amp;timeout=30m0s&amp;timeoutSeconds=479: dial tcp 127.0.0.1:6443: connect: connection refused\n2020\/05\/23 14:08:12 [ERROR] failed on subscribe storageClass: Get https:\/\/192.168.3.122:6443\/apis\/storage.k8s.io\/v1\/storageclasses?resourceVersion=0&amp;timeout=30m0s&amp;timeoutSeconds=1800&amp;watch=true: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:08:35.963845       7 reflector.go:280] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to watch *v1.Deployment: Get https:\/\/192.168.3.122:6443\/apis\/apps\/v1\/watch\/deployments?allowWatchBookmarks=true&amp;resourceVersion=1088&amp;timeout=30m0s&amp;timeoutSeconds=536: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:08:36.008130       7 reflector.go:280] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to watch *v3.ClusterUserAttribute: Get https:\/\/192.168.3.122:6443\/apis\/cluster.cattle.io\/v3\/watch\/namespaces\/cattle-system\/clusteruserattributes?allowWatchBookmarks=true&amp;resourceVersion=920&amp;timeout=30m0s&amp;timeoutSeconds=497: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:08:36.437059       7 reflector.go:280] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to watch *v1.ClusterRole: Get https:\/\/192.168.3.122:6443\/apis\/rbac.authorization.k8s.io\/v1\/watch\/clusterroles?allowWatchBookmarks=true&amp;resourceVersion=1111&amp;timeout=30m0s&amp;timeoutSeconds=417: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:08:36.966440       7 reflector.go:123] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to list *v1.Deployment: Get https:\/\/192.168.3.122:6443\/apis\/apps\/v1\/deployments?limit=500&amp;resourceVersion=0&amp;timeout=30s: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:08:37.968963       7 reflector.go:123] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to list *v1.Deployment: Get https:\/\/192.168.3.122:6443\/apis\/apps\/v1\/deployments?limit=500&amp;resourceVersion=0&amp;timeout=30s: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:09:05.950401       7 reflector.go:280] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to watch *v1.Endpoints: Get https:\/\/192.168.3.122:6443\/api\/v1\/watch\/namespaces\/cattle-prometheus\/endpoints?allowWatchBookmarks=true&amp;resourceVersion=1225&amp;timeout=30m0s&amp;timeoutSeconds=486: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:09:35.975039       7 reflector.go:280] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to watch *v1beta1.CronJob: Get https:\/\/192.168.3.122:6443\/apis\/batch\/v1beta1\/watch\/cronjobs?allowWatchBookmarks=true&amp;resourceVersion=1&amp;timeout=30m0s&amp;timeoutSeconds=374: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:09:36.959433       7 reflector.go:280] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to watch *v1.Endpoints: Get https:\/\/192.168.3.122:6443\/api\/v1\/watch\/namespaces\/cattle-prometheus\/endpoints?allowWatchBookmarks=true&amp;resourceVersion=1669&amp;timeout=30m0s&amp;timeoutSeconds=427: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:10:07.465674       7 reflector.go:280] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to watch *v1beta1.Ingress: Get https:\/\/192.168.3.122:6443\/apis\/extensions\/v1beta1\/watch\/ingresses?allowWatchBookmarks=true&amp;resourceVersion=1&amp;timeout=30m0s&amp;timeoutSeconds=423: dial tcp 127.0.0.1:6443: connect: connection refused\nE0523 14:10:36.455139       7 reflector.go:280] github.com\/rancher\/norman\/controller\/generic_controller.go:193: Failed to watch *v1.ConfigMap: Get https:\/\/192.168.3.122:6443\/api\/v1\/watch\/namespaces\/cattle-system\/configmaps?allowWatchBookmarks=true&amp;resourceVersion=845&amp;timeout=30m0s&amp;timeoutSeconds=478: dial tcp 127.0.0.1:6443: connect: connection refused<\/code><\/pre>\n<p>Congratulation! You very own Kubernetes cluster is now up and running. Now it's time to deploy an App!<br \/>\n<img decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/dashboard.png\" alt=\"nodes\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/codestrian.com\/wp-content\/uploads\/2020\/05\/workers.png\" alt=\"nodes\" \/><\/p>\n<p>FAQ<br \/>\nQ: Worker taking forever to register<br \/>\nA: Delete \/var\/lib\/kubelet\/ and try again.<\/p>\n<p>Q: error &quot;tls: failed to verify client's certificate: x509: certificate signed by unknown authority (possibly because of \\&quot;crypto\/rsa: verification error\\&quot; while trying to verify candidate authority certificate \\&quot;kube-ca\\&quot;)&quot;, ServerName &quot;&quot;<br \/>\nA: Delete \/etc\/kubernetes and try again<\/p>\n<p>Q: Is Rancher\/Rancher:v2.3.5 the only version I can use<br \/>\nA: No, I have tried Rancher\/Rancher:v2.4-head which works fine too.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It has been a while since I purchased my Raspberry Pi 4. There was not much success in my previous attempts in getting rancher to run. The reason is due to incompatibility between Raspbian and Rancher. With the release of Ubuntu 20.04 LTS last month, I decided to try to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[54,56,55],"_links":{"self":[{"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/posts\/455"}],"collection":[{"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/comments?post=455"}],"version-history":[{"count":15,"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/posts\/455\/revisions"}],"predecessor-version":[{"id":481,"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/posts\/455\/revisions\/481"}],"wp:attachment":[{"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/media?parent=455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/categories?post=455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codestrian.com\/index.php\/wp-json\/wp\/v2\/tags?post=455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}