raspberry
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
raspberry [2022/10/02 19:37] – skipidar | raspberry [2023/03/29 06:56] (current) – [Remote install of image per ssh] skipidar | ||
---|---|---|---|
Line 693: | Line 693: | ||
- | === Install OS === | + | === Install OS Raspberry === |
+ | https:// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | === Install OS Ubuntu | ||
Use Ubuntu Server 22.04.1. The Current LTS version. | Use Ubuntu Server 22.04.1. The Current LTS version. | ||
Line 701: | Line 709: | ||
{{https:// | {{https:// | ||
- | **Attention: | + | **Attention: |
https:// | https:// | ||
- | The 32bit version is based on " | + | The 32bit version is based on " |
< | < | ||
error: snap " | error: snap " | ||
Line 711: | Line 719: | ||
- | === Install " | ||
- | * Kubernetes: **MicroK8s** is a low-ops, minimal production Kubernetes, for devs, cloud, clusters, workstations, | ||
- | <color #ed1c24> | + | === Install " |
- | Attention: didnt work For some reason microk8s was not running after the installation. | + | http://www.armand.nz/ |
- | All the start/stop commands failed. As it was about a fast and easy way to start - moved on to get.k3s.io</color> | + | https://www.puzzle.ch/de/ |
- | As described e.g. in https:// | ||
- | Install | + | Install |
+ | https:// | ||
- | < | + | ==Prerequisites for the installation== |
- | sudo snap install microk8s --classic | + | |
- | </ | + | |
- | <sxh shell> | + | Mount the sd-card, open the file `cmdline.txt` and append. |
- | pi@ubuntu: | + | It enables some backward compatibility raspberry kernel modules. |
- | microk8s (1.25/stable) v1.25.0 from Canonical✓ installed | + | |
- | pi@ubuntu: | + | |
- | </ | + | |
- | + | ||
- | You can also learn about available versions and pick a concrete version | + | |
< | < | ||
- | snap info microk8s | + | cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory |
</ | </ | ||
- | Returns | + | The file `cmdline.txt` |
<sxh shell> | <sxh shell> | ||
- | pi@ubuntu: | + | console=serial0,115200 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc quiet splash |
- | name: microk8s | + | cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory |
- | summary: | + | |
- | publisher: Canonical✓ | + | |
- | store-url: https:// | + | |
- | contact: | + | |
- | license: | + | |
- | description: | + | |
- | MicroK8s is a small, fast, secure, single node Kubernetes that installs on | + | |
- | just about any Linux box. Use it for offline development, | + | |
- | testing, or use it on a VM as a small, cheap, reliable k8s for CI/CD. It's | + | |
- | also a great k8s for appliances - develop your IoT apps for k8s and deploy | + | |
- | them to MicroK8s on your boxes. | + | |
- | commands: | + | |
- | - microk8s.add-node | + | |
- | - microk8s.addons | + | |
- | - microk8s.cilium | + | |
- | - microk8s.config | + | |
- | - microk8s.ctr | + | |
- | - microk8s.dashboard-proxy | + | |
- | - microk8s.dbctl | + | |
- | - microk8s.disable | + | |
- | - microk8s.enable | + | |
- | - microk8s.helm | + | |
- | - microk8s.helm3 | + | |
- | - microk8s.images | + | |
- | - microk8s.inspect | + | |
- | - microk8s.istioctl | + | |
- | - microk8s.join | + | |
- | - microk8s.kubectl | + | |
- | - microk8s.leave | + | |
- | - microk8s.linkerd | + | |
- | - microk8s | + | |
- | - microk8s.refresh-certs | + | |
- | - microk8s.remove-node | + | |
- | - microk8s.reset | + | |
- | - microk8s.start | + | |
- | - microk8s.status | + | |
- | - microk8s.stop | + | |
- | - microk8s.version | + | |
- | services: | + | |
- | microk8s.daemon-apiserver-kicker: | + | |
- | microk8s.daemon-apiserver-proxy: | + | |
- | microk8s.daemon-cluster-agent: | + | |
- | microk8s.daemon-containerd: | + | |
- | microk8s.daemon-etcd: | + | |
- | microk8s.daemon-flanneld: | + | |
- | microk8s.daemon-k8s-dqlite: | + | |
- | microk8s.daemon-kubelite: | + | |
- | snap-id: | + | |
- | tracking: | + | |
- | refresh-date: | + | |
- | channels: | + | |
- | 1.25/ | + | |
- | 1.25/ | + | |
- | 1.25/ | + | |
- | 1.25/ | + | |
- | latest/ | + | |
- | latest/ | + | |
- | latest/ | + | |
- | latest/ | + | |
- | 1.26/ | + | |
- | 1.26/ | + | |
- | 1.26/ | + | |
- | 1.26/ | + | |
- | 1.25-strict/ | + | |
</ | </ | ||
- | And a concrete version can be installed via | ||
- | < | ||
- | sudo snap install microk8s --classic --channel=1.25/ | ||
- | </ | ||
- | |||
- | |||
- | == Pick the master node == | ||
- | |||
- | On the master node command. It will take some minutes. | ||
- | < | ||
- | sudo microk8s.add-node | ||
- | </ | ||
- | |||
- | |||
- | Output: | ||
- | <sxh shell> | ||
- | pi@ubuntu: | ||
- | From the node you wish to join to this cluster, run the following: | ||
- | microk8s join 192.168.191.34: | ||
- | |||
- | Use the ' | ||
- | microk8s join 192.168.191.34: | ||
- | |||
- | If the node you are adding is not reachable through the default interface you can use one of the following: | ||
- | microk8s join 192.168.191.34: | ||
- | pi@ubuntu: | ||
- | |||
- | </ | ||
- | |||
- | |||
- | == Join the cluster with second pi == | ||
- | |||
- | On the second pi, in same network | ||
- | |||
- | < | ||
- | sudo microk8s join 192.168.191.34: | ||
- | </ | ||
== Debug check success == | == Debug check success == | ||
- | |||
- | To check the status of cluster do | ||
- | < | ||
- | sudo microk8s.status | ||
- | </ | ||
- | |||
Line 873: | Line 764: | ||
Sep 30 07:03:10 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | Sep 30 07:03:10 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | ||
Sep 30 07:04:30 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | Sep 30 07:04:30 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | ||
- | |||
</ | </ | ||
- | < | + | An easy enough debugging step is to run a stop and start. |
- | journalctl -xeu snap.microk8s.daemon-containerd.service | + | |
- | systemctl status snap.microk8s.daemon-containerd.service | + | |
- | </ | + | |
- | An easy enough debugging step is to run a stop and start. | + | ==Install linux-modules-extra-raspi extra package== |
+ | Through lots of frustration, | ||
- | < | + | Only by installing this kernel module I was able to finally get my ubuntu raspberry pi modules to a `STATUS: Ready state`. Evidently, this only affects the Rasberry Pi install of Ubuntu. |
- | sudo microk8s.stop | + | |
- | sudo microk8s.start | + | |
- | </ | + | |
+ | On each Raspberry PI Install the `linux-modules-extra-raspi` extra package, a specific requirement for Ubuntu 21.10+ and k3s on Raspberry Pis | ||
- | Look at the cluster info and make sure it’s up: | + | Run the following to install the module. |
+ | A reboot is required to take effect | ||
< | < | ||
- | $ sudo microk8s.kubectl cluster-info | + | sudo apt install linux-modules-extra-raspi |
+ | sudo reboot | ||
</ | </ | ||
- | <sxh shell> | ||
- | $ sudo microk8s.kubectl cluster-info | ||
- | Kubernetes master is running at https:// | ||
- | To further debug and diagnose cluster problems, use ' | + | ==Setup the Master k3s Node== |
- | </ | + | |
+ | The Master node’s (k8s0) initial k3s installation will serve as the control plane for our Kubernetes Cluster. | ||
- | == Reset the k8s == | + | Install K3s with the flags to make sure / |
- | You can clean-up MicroK8s installation by running the following command: | + | as in https://k3s.io/ |
- | This command is used to return the MicroK8s node to the default initial state. This process may take some time and will remove any resources, authentication, | ||
- | |||
- | This commands makes it easy to revert your MicroK8s to an ‘install fresh’ state wihout having to reinstall anything. | ||
+ | Start installation | ||
< | < | ||
- | sudo microk8s.reset | + | # seem to have been required to set ownership on configs in the past https:// |
+ | export K3S_KUBECONFIG_MODE=" | ||
+ | |||
+ | # the command might use prev. environment variable | ||
+ | curl -sfL https:// | ||
</ | </ | ||
+ | |||
+ | |||
<sxh shell> | <sxh shell> | ||
- | Cleaning resources in namespace default | + | pi@pi2:~$ curl -sfL https:// |
- | No resources found | + | [INFO] |
- | endpoints " | + | [INFO] |
- | secret " | + | [INFO] |
- | serviceaccount " | + | [INFO] |
- | service | + | [INFO] |
+ | [INFO] | ||
+ | [INFO] | ||
+ | [INFO] | ||
+ | [INFO] | ||
+ | [INFO] | ||
+ | [INFO] | ||
+ | [INFO] | ||
+ | [INFO] | ||
+ | [INFO] | ||
+ | [INFO] | ||
+ | Created symlink / | ||
+ | [INFO] | ||
</ | </ | ||
+ | Check for Ready node, takes ~30 seconds | ||
+ | < | ||
+ | sudo systemctl status k3s | ||
+ | </ | ||
- | === Install "k3s" | + | <sxh shell> |
- | http://www.armand.nz/2022/06/01/install-k3s-kubernetes-on-raspberry-pi.html | + | pi@pi2:~$ sudo systemctl status |
- | https://www.puzzle.ch/de/blog/articles/2020/10/13/k3s-on-raspberry-pi | + | ● k3s.service - Lightweight |
+ | Loaded: loaded (/etc/systemd/system/k3s.service; | ||
+ | | ||
+ | Docs: https://k3s.io | ||
+ | Process: 6146 ExecStartPre=/ | ||
+ | | ||
+ | Process: 6149 ExecStartPre=/ | ||
+ | Main PID: 6150 (k3s-server) | ||
+ | Tasks: 119 | ||
+ | | ||
+ | CPU: 4min 13.990s | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | Oct 05 06:49:01 pi2 k3s[6150]: I1005 06: | ||
+ | Oct 05 06:49:01 pi2 k3s[6150]: Trace[1718652963]: | ||
+ | </ | ||
+ | You can check if the master node is working. At this point, there is only one Master node | ||
+ | < | ||
+ | k3s kubectl get node | ||
+ | </ | ||
- | | + | <sxh shell> |
+ | pi@pi2:~$ k3s kubectl get node | ||
+ | NAME | ||
+ | pi2 Ready control-plane,master | ||
+ | </ | ||
- | Install k3s. | + | By default, the Kubernetes API server listens on port **6443**. |
- | https:// | + | You can check if the k8s server is listening on the port 6443 |
- | + | ||
- | ==Prerequisites for the installation== | + | |
- | + | ||
- | Mount the sd-card, open the file `cmdline.txt` and append. | + | |
- | It enables some backward compatibility raspberry kernel modules. | + | |
< | < | ||
- | cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory | + | sudo ss -tulpn | grep :6443 |
</ | </ | ||
- | The file `cmdline.txt` | + | |
<sxh shell> | <sxh shell> | ||
- | console=serial0,115200 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc quiet splash | + | pi@pi2:~$ sudo ss -tulpn | grep :6443 |
- | cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory | + | tcp |
- | </ | + | |
+ | pi@pi2:~$ sudo ps aux | grep 6150 | ||
+ | root 6150 53.9 52.2 1250788 484324 ? Ssl 06:46 8:15 / | ||
+ | pi 9717 2.0 0.1 | ||
+ | pi@pi2:~$ ls / | ||
+ | crictl | ||
+ | </ | ||
- | == Debug check success | + | ==Attach worker nodes to master== |
+ | On k8s server / mater - get teh token | ||
- | Sometimes, if the above command doesn’t respond. There might be something or other wrong. Checking on the kubelet with journalctl is a good place to start looking for info. | ||
- | Or maybe do a common error check | ||
- | |||
- | all errors | ||
< | < | ||
- | journalctl | + | # NODE_TOKEN comes from / |
+ | sudo cat / | ||
</ | </ | ||
<sxh shell> | <sxh shell> | ||
- | Sep 30 07:01:59 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | + | pi@pi2:~$ sudo cat / |
- | Sep 30 07:02:27 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | + | T10eb2811f7856b5895acac5179c6ae29787957f5289bb00737cf144ac58da851c4::server:9acae609ca530528b4bcc3219720705b |
- | Sep 30 07:02:37 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | + | |
- | Sep 30 07:02:45 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | + | |
- | Sep 30 07:03:10 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | + | |
- | Sep 30 07:04:30 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | + | |
</ | </ | ||
+ | Figure out the ip of your server | ||
< | < | ||
- | journalctl -xeu snap.microk8s.daemon-containerd.service | + | ip a |
- | systemctl status snap.microk8s.daemon-containerd.service | + | |
</ | </ | ||
+ | The **eth0** adapter is relevant for me. | ||
+ | <sxh shell> | ||
+ | pi@pi2:~$ ip a | ||
+ | 1: lo: < | ||
+ | link/ | ||
+ | inet 127.0.0.1/8 scope host lo | ||
+ | | ||
+ | inet6 ::1/128 scope host | ||
+ | | ||
+ | 2: eth0: < | ||
+ | link/ether b8: | ||
+ | inet 192.168.191.32/ | ||
+ | | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | 3: wlan0: < | ||
+ | link/ether b8: | ||
+ | 4: flannel.1: < | ||
+ | link/ether 3a: | ||
+ | inet 10.42.0.0/ | ||
+ | | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | 5: cni0: < | ||
+ | link/ether 2e: | ||
+ | inet 10.42.0.1/ | ||
+ | | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | 6: vethf8a47774@if2: | ||
+ | link/ether 22: | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | 7: veth4dd4db4c@if2: | ||
+ | link/ether 92: | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | 10: veth82490627@if2: | ||
+ | link/ether 92: | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | 11: veth99adcc15@if2: | ||
+ | link/ether f2: | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | 12: veth748d4e42@if2: | ||
+ | link/ether 32: | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | </ | ||
- | An easy enough debugging step is to run a stop and start. | ||
- | |||
- | |||
- | ==Install linux-modules-extra-raspi extra package== | ||
- | |||
- | Through lots of frustration, | ||
- | |||
- | Only by installing this kernel module I was able to finally get my ubuntu raspberry pi modules to a `STATUS: Ready state`. Evidently, this only affects the Rasberry Pi install of Ubuntu. | ||
- | |||
- | On each Raspberry PI Install the `linux-modules-extra-raspi` extra package, a specific requirement for Ubuntu 21.10+ and k3s on Raspberry Pis | ||
+ | On a different node run the below command. | ||
< | < | ||
- | sudo apt install linux-modules-extra-raspi | + | export K3S_KUBECONFIG_MODE=" |
- | sudo reboot | + | export K3S_URL=" |
- | </code> | + | export K3S_TOKEN=" |
- | Run the following to install the module. | + | curl -sfL https:// |
- | A reboot is required to take effect | + | |
- | + | ||
- | < | + | |
- | sudo apt install linux-modules-extra-raspi | + | |
- | sudo reboot | + | |
</ | </ | ||
- | ==Setup the Master k3s Node== | ||
- | The Master node’s (k8s0) initial k3s installation will serve as the control plane for our Kubernetes Cluster. | + | ==== Remote install of image per ssh ==== |
+ | see | ||
+ | https:// | ||
- | Install K3s with the flags to make sure / | + | * Login via SSH to the system on which the image is located and read it via dd. The stdout is tunneled through SSH to the local system. |
+ | * Using pv you can see how much data is transferred. (You may need to install it with apt-get, but you can also omit this.) | ||
+ | * funzip extracts the first file and sends it to stdout. | ||
+ | * dd writes it to the SD-card. | ||
< | < | ||
- | curl -sfL https:// | ||
- | curl -sfL https:// | ||
- | # Check for Ready node, takes ~30 seconds | ||
- | |||
- | # Kubeconfig is written to / | ||
- | sudo k3s kubectl get node | ||
- | </ | ||
+ | #This will enable the reset of the Raspberry without regular commands. | ||
+ | echo 1 > / | ||
+ | #download image | ||
+ | curl -L http:// | ||
+ | # restart the pi (Sofortiger Neustart des Systems (ohne Synchronisation der Speichermedien!)) | ||
+ | echo b > / | ||
+ | </ |
raspberry.1664739464.txt.gz · Last modified: by skipidar