Code Monkey home page Code Monkey logo

rpi-microk8s's Introduction

rpi-microk8s

Requirements:

Mac computer for flashing 2x Raspberry Pi 4 8GB (4GB/2GB may work)

  1. flash ubuntu server 22.04.2 LTS 64 bit

    set hostname enable SSH ssh keygen if you don't have an SSH key yet Allow public -key authentication only check "set username and password" use terminus

  2. sudo apt update && sudo apt upgrade && sudo apt install zsh neovim then reboot sudo reboot

then get oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

sudo nvim /boot/firmware/cmdline.txt

add cgroup_enable=memory cgroup_memory=1 to each pi

sudo reboot

now install microk8s

sudo snap install microk8s --classic

enable microk8s group services on each pi:

sudo usermod -a -G microk8s <user> newgrp microk8s

enable services one at a time: microk8s enable dns microk8s enable dashboard microk8s enable storage microk8s enable ingress

on master node: microk8s add-node

on master node, update the hosts before adding with the --worker command

sudo nvim /etc/cloud/templates/hosts.debian.tmpl

like:

192.168.0.123 kubeNodeName (output of $ hostname)

then copy to /etc/hosts on master node. Otherwise worker nodes cannot connect to the master node.

token is only good for a single attempt - run microk8s add-node again and for each pi

now get to kubernetes dashboard:

expose the dashboard over nodeport to access the dashboard outside the cluster:

microk8s.kubectl -n kube-system edit service kubernetes-dashboard

change type: ClusterIP to type: NodePort and save the file.

then $ microk8s kubectl get all --all-namespaces and check the port after 443:

then go to https://<lan IP>:port and get the dashboard

now setup KubeConfig so you dont have to get token every time

First get gh cli to clone other OSS configs:

type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y

rpi-microk8s's People

Contributors

ryan-haines avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.