{"id":362,"date":"2023-10-06T20:06:35","date_gmt":"2023-10-07T00:06:35","guid":{"rendered":"https:\/\/davidfailor.com\/?page_id=362"},"modified":"2024-01-19T02:19:30","modified_gmt":"2024-01-19T07:19:30","slug":"hybrid-local-and-cloud-network-with-aws-and-kubernetes-2","status":"publish","type":"page","link":"https:\/\/davidfailor.com\/index.php\/hybrid-local-and-cloud-network-with-aws-and-kubernetes-2\/","title":{"rendered":"Hybrid Local\/Cloud Network with K8S and AWS"},"content":{"rendered":"<p class=\"has-white-background-color has-background\"><strong>I am currently working on a project to link 2 Raspberry Pi\u2019s, 1 Orange Pi, and a Dell PC using Docker containers and Kubernetes.\u00a0 My cloud platform is Amazon Web Services.\u00a0 The purpose is to demonstrate a hybrid local and cloud network system.<\/strong><\/p>\n<p class=\"has-white-background-color has-background\">Here are some videos and articles for a better understanding of the process:<\/p>\n<ul>\n<li>\u201cHow to Build Your Own Raspberry Pi Kubernetes Cluster! @https:\/\/youtu.be\/B2wAJ5FLOYw<\/li>\n<li>\u201cKubernetes Docker + Pi\u201d @https:\/\/youtu.be\/XvlkYL1dGbw<\/li>\n<li>\u201cWhat is K3S? (Kubernetes)\u201d @https:\/\/youtu.be\/IunGsYpgtJQ<\/li>\n<li>\u201cI built a Raspberry Pi SUPER COMPUTER!!\u201d @https:\/\/youtu.be\/X9fSMGkjtug<\/li>\n<li>\u201cDocker networking is CRAZY!! (you NEED to learn it)\u201d @<a href=\"https:\/\/youtu.be\/bKFMS5C4CG0\">https:\/\/youtu.be\/bKFMS5C4CG0<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/iot\/latest\/developerguide\/connecting-to-existing-device.html\">Connect a Raspberry Pi or other device \u2013 AWS IoT Core (amazon.com)<\/a><\/li>\n<li><a href=\"https:\/\/aws.amazon.com\/blogs\/containers\/building-an-amazon-ecs-anywhere-home-lab-with-amazon-vpc-network-connectivity\/\">Building an Amazon ECS Anywhere home lab with Amazon VPC network connectivity | Containers<\/a><\/li>\n<li><a href=\"https:\/\/community.element14.com\/products\/raspberry-pi\/b\/blog\/posts\/connecting-a-raspberry-pi-to-aws-iot-core\">Connecting a Raspberry Pi to AWS IoT Core \u2013 element14 Community<\/a><\/li>\n<\/ul>\n<p class=\"has-white-background-color has-background\">1. Here are the IoT devices. I had to purchase a power supply, heat sinks, and two fans and I installed the fans across the 5V terminals of the Raspberry and Orange Pi.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-288 size-medium\" src=\"https:\/\/davidfailor.com\/wp-content\/uploads\/2023\/10\/pies-225x300.jpg\" sizes=\"auto, (max-width: 225px) 100vw, 225px\" srcset=\"https:\/\/davidfailor.com\/wp-content\/uploads\/2023\/10\/pies-225x300.jpg 225w, https:\/\/davidfailor.com\/wp-content\/uploads\/2023\/10\/pies-768x1024.jpg 768w, https:\/\/davidfailor.com\/wp-content\/uploads\/2023\/10\/pies-1152x1536.jpg 1152w, https:\/\/davidfailor.com\/wp-content\/uploads\/2023\/10\/pies-1536x2048.jpg 1536w, https:\/\/davidfailor.com\/wp-content\/uploads\/2023\/10\/pies-300x400.jpg 300w, https:\/\/davidfailor.com\/wp-content\/uploads\/2023\/10\/pies-850x1133.jpg 850w, https:\/\/davidfailor.com\/wp-content\/uploads\/2023\/10\/pies.jpg 1620w\" alt=\"\" width=\"225\" height=\"300\" \/><\/p>\n<div>\n<p>Oct 9th: I tried to replace the Orange Pi 3B image with Raspberry Pi image (Ubuntu Server 64 bit). \u00a0Didn\u2019t work. \u00a0I\u2019m guessing the hardware architecture is slightly different.<\/p>\n<p>Trying Ubuntu \u201cfocal_server\u201d image. \u00a0Apparently the \u201cjammy_server\u201d Ubuntu version has vulnerabilities where the attacker is able to obtain root access immediately via an unknown attack vector. \u00a0Although this is a learning project I\u2019m trying to use good security practices so I will use the focal version.<\/p>\n<p>The difficulty with the Orange Pi is that although it is more powerful than the Raspberry Pi and has more interfaces (like connection to an SSD drive), and it is less expensive, there is not as much documentation nor as many download options, just because the RPi is more popular. \u00a0The link I found for the Ubuntu Server was stored on a Google Drive, so the download was not as fast as it would be like it would be for other Linux software from normal repos.\u00a0 It makes me &#8220;nervous&#8221; downloading an image file from someone&#8217;s G-Drive but that is the link that was recommended on the Orange Pi site.\u00a0 I couldn&#8217;t find a hash for the file online but the download did include a sha256 hash, so all I could do was to hash the image file and compare it to the sha256 file.\u00a0 They matched but that doesn&#8217;t necessarily mean the file does not contain malware.\u00a0 The img file is large but I did scan it with ClamAV after updating the virus signatures.\u00a0 (The file size was too big to upload to VirusTotal online).<\/p>\n<p>I finally had to download the zipped img file and extract it. Then I was able to write it to the SD card for the Orange Pi. \u00a0(I \u201ccheated\u201d and used the rpi-imager [Raspberry Pi Imager] software but I could just as well have used Balena Etcher or even &#8220;dd&#8221; from the CLI interface. \u00a0Once I imaged the SD card I loaded it back into the Orange Pi and rebooted. \u00a0Fortunately I turned the monitor off and back on because the installation was running in the background but it appeared at first that nothing was happening because the screen was blank.<\/p>\n<p>The Ubuntu server is headless so it boots to the command line.\u00a0 Then I connected the OPi to my ethernet connection and updated and upgraded the system (apt update, apt upgrade).<\/p>\n<p>Now I need to update SSH, install Docker and Kubernetes but it is late at night so I&#8217;m going to do that another day.\u00a0 Then I need to do the same to my Raspberry Pi 3B and my Raspberry Pi 4+. \u00a0The RPi 4 and OPi 3B are more powerful and have more memory than the RPi 3B so I will most likely make the 3B the \u201cmaster\u201d node and the other two will be the \u201cworker\u201d nodes since the worker ones do most of the work.<\/p>\n<p>I can set up Kubernetes (aka \u201cK8s\u201d) over WiFi or Ethernet so long as the devices are connected on the same network. \u00a0My preference is to use shorter Ethernet cables attached to the same switch (TP-Link) because of speed and reliability, but we will have to see how it works because I don\u2019t want to invest in a lot of extra equipment since this is more of a \u201cproof of concept\u201d and learning experience. \u00a0In truth, once I successfully create my Docker containers on Kubernetes and connect it to my remote cloud AWS configuration I will probably tear it all down and use one of the RPis as a PC and the 3B as a retro pi game device. \u00a0The Orange Pi might become my PC&#8211;I need to \u201cplay\u201d with it first to see how well it performs.\u00a0 The 4+ is powerful and has 8 GB Ram so there are a lot of potential uses for it&#8230;some other projects I&#8217;d like to try are a home NAS media storage among other ideas.\u00a0 (All 3 devices have programmable pin outs for interfaces with the &#8220;outside world&#8221; so lots of IoT possibilities).<\/p>\n<p>Oct 15, 2023.\u00a0 I booted my rpi 3 and 4 so I could back up any files I need to save.\u00a0 The rpi 3 was corrupted and would only boot into safe mode but I couldn&#8217;t repair the fstab file from within the rpi 3 CLI so I loaded it in an SD Card reader and edited it from my PC.\u00a0 I could have started with that approach but I first wanted to see if there was any way to fix the rpi without using another device.\u00a0 I gave up after a couple of hours and used the CLI and text editor (nano) on my Linux PC and tried to fix it, then I re-imaged the rpi OS.\u00a0 Then I created a new EC2 instance on my AWS cloud account but wasted time &#8220;deep in the rabbit hole&#8221; while trying to figure out why it would not allow me to SSH to connect to the public DNS IP address and user of the EC2 instance using the key pair value I created.\u00a0 (ssh -v -i keyfile.pem ec2-user@[AWS IP4 address] ).\u00a0 I verified that my SSH works by connecting to another website, so I&#8217;ll need to review the Amazon documentation again.\u00a0 I am trying to test both ends of my hybrid cloud network to make sure each component works before &#8220;stitching&#8221; them together to finalize my project.<\/p>\n<p>The next step will be to load Kubernetes and Docker on all 3 Pi&#8217;s, and change the config files on the Pi&#8217;s to allow them to work together.\u00a0 Then I will designate one as the control pane &#8220;master&#8221; and the other two nodes as the &#8220;slave&#8221; devices for K8S and create the pods.\u00a0 After that I will connect them to an instance on AWS.\u00a0 I found something yesterday when reviewing the AWS documentation that they already have an IoT option for connections in a hybrid network, so there might be an easier way, but my way would be applicable to hybrid networks in general (not just to IoT devices).<\/p>\n<p>11\/1\/2023 I finally had time to load K8S and Docker on my rpi 4.\u00a0 I still have to load Kubernetes and Docker on the rpi 3 and my orange pi.\u00a0 I&#8217;ve been &#8220;playing&#8221; with AWS trying to get my connection to work through my Xfinity router.\u00a0 I probably have to change some of the settings so I&#8217;ll log in as admin when I get a chance.<\/p>\n<p>11\/12\/23\u2026I will continue working on this project but with a different cloud provider than AWS. \u00a0As it turns out their so-called free tier is not free and without any warning Amazon switched my account to regular billing. \u00a0I cancelled my AWS account today because of the apparent deception.<\/p>\n<\/div>\n<p>1\/19\/24\u2026I installed Ubuntu server 64 bit on my rpi 3B. \u00a0I was having some minor difficulty setting up ssh remote access on this device over Wi-Fi. \u00a0I may need to use Ethernet until I resolve this. \u00a0Then I need to install the lightweight Kubernetes for rpi and repeat this process on my other two devices. \u00a0(K8S works best on the 64 bit Ubuntu server on the Raspberry Pi).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am currently working on a project to link 2 Raspberry Pi\u2019s, 1 Orange Pi, and a Dell PC using Docker containers and Kubernetes.\u00a0 My cloud platform is Amazon Web Services.\u00a0 The purpose is to demonstrate a hybrid local and cloud network system. Here are some videos and articles for a better understanding of the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-362","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/davidfailor.com\/index.php\/wp-json\/wp\/v2\/pages\/362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davidfailor.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/davidfailor.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/davidfailor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davidfailor.com\/index.php\/wp-json\/wp\/v2\/comments?post=362"}],"version-history":[{"count":11,"href":"https:\/\/davidfailor.com\/index.php\/wp-json\/wp\/v2\/pages\/362\/revisions"}],"predecessor-version":[{"id":539,"href":"https:\/\/davidfailor.com\/index.php\/wp-json\/wp\/v2\/pages\/362\/revisions\/539"}],"wp:attachment":[{"href":"https:\/\/davidfailor.com\/index.php\/wp-json\/wp\/v2\/media?parent=362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}