raspberry
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
raspberry [2022/10/05 06:21] – 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 710: | Line 718: | ||
- | |||
- | === Install " | ||
- | |||
- | * Kubernetes: **MicroK8s** is a low-ops, minimal production Kubernetes, for devs, cloud, clusters, workstations, | ||
- | |||
- | <color #ed1c24> | ||
- | Attention: didnt work For some reason microk8s was not running after the installation. | ||
- | All the start/stop commands failed. As it was about a fast and easy way to start - moved on to get.k3s.io</ | ||
- | |||
- | As described e.g. in https:// | ||
- | |||
- | Install microk8s. | ||
- | |||
- | < | ||
- | sudo snap install microk8s --classic | ||
- | </ | ||
- | |||
- | <sxh shell> | ||
- | pi@ubuntu: | ||
- | microk8s (1.25/ | ||
- | pi@ubuntu: | ||
- | </ | ||
- | |||
- | You can also learn about available versions and pick a concrete version | ||
- | |||
- | < | ||
- | snap info microk8s | ||
- | </ | ||
- | |||
- | Returns | ||
- | <sxh shell> | ||
- | pi@ubuntu: | ||
- | name: microk8s | ||
- | 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 == | ||
- | |||
- | To check the status of cluster do | ||
- | < | ||
- | sudo microk8s.status | ||
- | </ | ||
- | |||
- | |||
- | |||
- | 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 -p err -b | ||
- | </ | ||
- | |||
- | <sxh shell> | ||
- | Sep 30 07:01:59 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | ||
- | Sep 30 07:02:27 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | ||
- | 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! | ||
- | |||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | An easy enough debugging step is to run a stop and start. | ||
- | |||
- | |||
- | < | ||
- | sudo microk8s.stop | ||
- | sudo microk8s.start | ||
- | </ | ||
- | |||
- | |||
- | Look at the cluster info and make sure it’s up: | ||
- | |||
- | < | ||
- | $ sudo microk8s.kubectl cluster-info | ||
- | </ | ||
- | |||
- | <sxh shell> | ||
- | $ sudo microk8s.kubectl cluster-info | ||
- | Kubernetes master is running at https:// | ||
- | |||
- | To further debug and diagnose cluster problems, use ' | ||
- | </ | ||
- | |||
- | |||
- | == Reset the k8s == | ||
- | |||
- | You can clean-up MicroK8s installation by running the following command: | ||
- | |||
- | 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. | ||
- | |||
- | |||
- | < | ||
- | sudo microk8s.reset | ||
- | </ | ||
- | |||
- | <sxh shell> | ||
- | Cleaning resources in namespace default | ||
- | No resources found | ||
- | endpoints " | ||
- | secret " | ||
- | serviceaccount " | ||
- | service " | ||
- | </ | ||
Line 929: | Line 724: | ||
http:// | http:// | ||
https:// | https:// | ||
- | |||
- | |||
- | |||
- | |||
- | * Kubernetes: **MicroK8s** is a low-ops, minimal production Kubernetes, for devs, cloud, clusters, workstations, | ||
Line 975: | Line 765: | ||
Sep 30 07:04:30 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | Sep 30 07:04:30 ubuntu kernel: hwmon hwmon1: Undervoltage detected! | ||
</ | </ | ||
- | |||
- | |||
- | < | ||
- | journalctl -xeu snap.microk8s.daemon-containerd.service | ||
- | systemctl status snap.microk8s.daemon-containerd.service | ||
- | </ | ||
Line 1011: | Line 795: | ||
as in https:// | as in https:// | ||
+ | |||
+ | |||
+ | Start installation | ||
< | < | ||
+ | # seem to have been required to set ownership on configs in the past https:// | ||
export K3S_KUBECONFIG_MODE=" | export K3S_KUBECONFIG_MODE=" | ||
- | curl -sfL https:// | ||
- | # Check for Ready node, takes ~30 seconds | ||
- | # Kubeconfig is written to /etc/ | + | # the command might use prev. environment variable |
- | sudo k3s kubectl get node | + | curl -sfL https://get.k3s.io | sh - |
</ | </ | ||
- | |||
- | |||
Line 1046: | Line 830: | ||
- | Run Server | + | Check for Ready node, takes ~30 seconds |
+ | < | ||
+ | sudo systemctl status k3s | ||
+ | </ | ||
+ | |||
+ | <sxh shell> | ||
+ | pi@pi2:~$ sudo systemctl status k3s | ||
+ | ● k3s.service - Lightweight Kubernetes | ||
+ | | ||
+ | | ||
+ | Docs: https:// | ||
+ | Process: 6146 ExecStartPre=/ | ||
+ | Process: 6148 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 | ||
< | < | ||
- | sudo k3s server & | + | k3s kubectl get node |
- | # Kubeconfig is written to / | + | </ |
- | sudo k3s kubectl get node | + | |
- | # On a different | + | <sxh shell> |
+ | pi@pi2:~$ k3s kubectl get node | ||
+ | NAME | ||
+ | pi2 Ready control-plane, | ||
+ | </ | ||
+ | |||
+ | |||
+ | By default, | ||
+ | You can check if the k8s server is listening on the port 6443 | ||
+ | < | ||
+ | sudo ss -tulpn | grep :6443 | ||
+ | </ | ||
+ | |||
+ | |||
+ | <sxh shell> | ||
+ | pi@pi2:~$ sudo ss -tulpn | grep :6443 | ||
+ | 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 | ||
+ | </ | ||
+ | |||
+ | ==Attach worker nodes to master== | ||
+ | |||
+ | On k8s server / mater - get teh token | ||
+ | |||
+ | < | ||
# NODE_TOKEN comes from / | # NODE_TOKEN comes from / | ||
- | sudo k3s agent --server | + | sudo cat / |
</ | </ | ||
+ | <sxh shell> | ||
+ | pi@pi2:~$ sudo cat / | ||
+ | T10eb2811f7856b5895acac5179c6ae29787957f5289bb00737cf144ac58da851c4:: | ||
+ | </ | ||
+ | |||
+ | |||
+ | Figure out the ip of your server | ||
+ | < | ||
+ | ip a | ||
+ | </ | ||
+ | |||
+ | 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:: | ||
+ | | ||
+ | </ | ||
+ | |||
+ | |||
+ | On a different node run the below command. | ||
+ | < | ||
+ | export K3S_KUBECONFIG_MODE=" | ||
+ | export K3S_URL=" | ||
+ | export K3S_TOKEN=" | ||
+ | |||
+ | curl -sfL https:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Remote install of image per ssh ==== | ||
+ | see | ||
+ | https:// | ||
+ | |||
+ | * 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. | ||
+ | |||
+ | < | ||
+ | |||
+ | #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.1664950860.txt.gz · Last modified: by skipidar