Skip to content

Instantly share code, notes, and snippets.

@ostanislaw
Last active September 23, 2022 14:16
Show Gist options
  • Save ostanislaw/2d916262793dcf68a5682ded2cc5e78a to your computer and use it in GitHub Desktop.
Save ostanislaw/2d916262793dcf68a5682ded2cc5e78a to your computer and use it in GitHub Desktop.

Hardware

odroid n2+ 4GB RAM

559,00 zł https://botland.com.pl/moduly-odroid/17195-odroid-n2-amlogic-s922x-cortex-a73a53-hexa-core-24ghz2ghz-4gb-ram-5904422345488.html

microsd 64GB

69,00 zł Sandisk Extreme Pro A2 64GB https://www.x-kom.pl/p/451874-karta-pamieci-microsd-sandisk-64gb-microsdxc-extreme-pro-170mb-s-a2-c10-v30.html

OS

Flasing tool

https://www.balena.io/etcher/

Armbian Debian (1)

https://www.armbian.com/odroid-n2/ Armbian_21.08.1_Odroidn2_bullseye_current_5.10.60.img.xz https://forum.armbian.com/topic/9057-install-script-gen-new-machine-id-and-ssh-host-keys-and-maybe-other-machine-specific-items/

Initial settings

Connect by ssh at root account or use HDMI + keyboard

(follow armbian documentation) Setup root password and user account

Call armbian-config utility for additonal configuration:

  • hostname
  • timezone
  • apt mirror sources
  • install docker

Add user to docker group

sudo usermod -aG docker $USER

Setup nfs

Prepare HDD

  • In cfdisk change partition type to Linux and write
  • disconnect/connect USB cable
  • mkfs.ext4 /dev/sdb1
  • e2label /dev/sda1 TOSHIBA_2TB

Fstab entry

  • get UUID:
blkid
  • prepare mount dir
sudo mkdir /mnt/hdd
  • prepare entry
UUID="54785f3a-061e-43c8-8745-2a1fa28f3682"   /mnt/hdd    ext4    defaults,noatime    0    1
  • mount
sudo mount /mnt/hdd
  • allow writes for user
sudo chmod 777 /mnt/hdd
  • create exported dir
sudo mkdir -p /mnt/hdd/exported
sudo chmod -R ugo+rwX /mnt/hdd/exported
sudo chown -R nobody:nogroup /mnt/hdd/exported/
sudo setfacl -Rm u::rwX,g::rwX,o::rwX,d:u::rwX,d:g::rwX,d:o::rwX /mnt/hdd/exported

File services for node with HDD

NFS

https://wiki.debian.org/NFSServerSetup

https://forum.armbian.com/topic/1482-howto-nfs-server-and-client-configuration/

https://zsitko.com/nfs-file-sharing-server-raspberry-pi/

https://ubuntu.com/server/docs/service-nfs

Install and setup share
apt install nfs-common nfs-kernel-server
# apt install nfs-common nfs-kernel-server portmap
# echo "portmap: 192.168.1." >> /etc/hosts.allow
# systemctl restart portmap
# echo "/mnt/hdd/exported 192.168.1.0/24(rw,all_squash,nohide,insecure,async,no_subtree_check)" >> /etc/exports
echo "/mnt/hdd/exported *(rw,all_squash,anonuid=1000,anongid=1000,nohide,insecure,async,no_subtree_check)" >> /etc/exports
exportfs -a
systemctl restart nfs-kernel-server
Test at client
apt install nfs-common
mkdir /tmp/nfs_test
mount -t nfs -o vers=4 odroid1.lan:/mnt/hdd/exported /tmp/nfs_test

Setup in fstab at client

apt install nfs-common
mkdir -p /mnt/hdd/exported

fstab entry

odroid1.lan:/mnt/hdd/exported /mnt/hdd/exported  nfs      defaults,noatime    0       0

SAMBA

https://wiki.debian.org/Samba/ServerSimple install with armbian config

  • add share to config vim /etc/samba/smb.conf
[exported]
	comment = Whole read-only storage
	path = /mnt/hdd/exported
	public = yes
	guest ok = yes
	browseable = yes
	writable = no

[writable_smb]
	comment = Storage writable from samba
	path = /mnt/hdd/exported/writable_smb
	public = yes
	guest ok = yes
	browseable = yes
	writable = yes
	create mask = 0666
	directory mask = 0777

[custom_dir]
	comment = readable custom_dir
	path = /mnt/hdd/exported/custom_dir/
	public = yes
	guest ok = yes
	browseable = yes
	writable = no
  • restart server
systemctl restart smbd

SAMBA client and other groups

sudo apt install samba sudo usermod -aG adm,dialout,fax,cdrom,floppy,tape,sudo,audio,dip,video,plugdev,netdev,lpadmin,scanner,sambashare,docker $USER

FTP

https://wiki.debian.org/vsftpd

  • install
apt install vsftpd
  • configure uncomment write_enable=YES and enable access for other users (nobody:nogroup) from nfs
vim /etc/vsftpd.conf
...
uncomment write_enable=YES
ucomment local_umask=000
....
systemctl restart vsftpd

Kubernetes

Prepare

https://k3s.io/ https://www.polarsparc.com/xhtml/Practical-K8S-N2.html

  • prepare machine id
root@odroid1 /m/h/e/shared_odroid# cat setup_hostname.sh 
#!/bin/bash
rm -f /etc/machine-id
dbus-uuidgen --ensure=/etc/machine-id
rm /var/lib/dbus/machine-id
dbus-uuidgen --ensure
cat /etc/machine-id
  • disable swap
vim /etc/default/armbian-zram-config

uncomment SWAP=false

reboot
  • install master node
curl -sfL https://get.k3s.io | sh -
k3s kubectl get node

Setup master node

cat setup_k3s_master.sh 
#!/bin/bash
K3S_KUBECONFIG_MODE="644"
curl -sfL https://get.k3s.io | sh -
echo ""
ip addr show dev eth0
echo ""
echo "K3S_TOKEN=$(cat /var/lib/rancher/k3s/server/node-token)"

Setup worker node

cat setup_k3s_worker.sh 
#!/bin/bash

K3S_KUBECONFIG_MODE="644"
K3S_TOKEN=<COPY FROM MASTER NODE>
K3S_URL=https://192.168.1.31:6433

curl -sfL https://get.k3s.io | sh -

Setup remote acess

scp root@odroid1.lan:/etc/rancher/k3s/k3s.yaml ~/.kube/config
vim ~/.kube/config

change server address server: https://odroid1.lan:6443

traefik

https://stackoverflow.com/questions/68565048/how-to-expose-traefik-v2-dashboard-in-k3d-k3s-via-configuration

Various services

Syncthing

MyJDownloader

PyLoad

Transmission

PiHole

Grafana/System Monitor??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment