Skip to content

Instantly share code, notes, and snippets.

@gintsgints
Last active March 2, 2019 04:30
Show Gist options
  • Save gintsgints/e90f4e1163d134da4e150fb9b4bac365 to your computer and use it in GitHub Desktop.
Save gintsgints/e90f4e1163d134da4e150fb9b4bac365 to your computer and use it in GitHub Desktop.

Nano PI Kubernetes install

Nano PI as base

http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO2#UbuntuCore_16.04

Follow instructions to download image - nanopi-neo2_sd_friendlycore-xenial_4.14_arm64_20181011.img

Write it to SD card (8 GB Min) with Win32 disk imager and put it into NanoPi. Connect to network, boot up and login with root/fa

I do not like root with known password

adduser username
# ^^ Do not forget to assign this user to sudoers.
usermod -a -G sudo username
usermod -a -G ssh username
# change root password
passwd
# change hostname of node. With NanoPi you can do it with utility:
sudo npi-config
# from your workstation
ssh-copy-id username@node

Next you have to assign your node fixed IP address. Make sure you write this address in file - /etc/hosts

Install kubectl

# as root user
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubectl

Start k3s

  1. Download binary from https://github.com/rancher/k3s/releases/download/v0.1.0/k3s-arm64

  2. Follow instructions here

https://github.com/rancher/k3s

Make k3s as background process

sudo vim /lib/systemd/system/k3s.service
# Add next file (add "agent" option to slave nodes)
[Unit]
Description=Lightweight Kubernetes
Documentation=https://k3s.io
After=network.target

[Service]
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/k3s server
KillMode=process
Delegate=yes
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity

[Install]
WantedBy=multi-user.target
# End of file
# Enable and start service
sudo chmod 755 /lib/systemd/system/k3s.service
sudo systemctl enable k3s.service
sudo systemctl start k3s.service
sudo journalctl -f -u k3s.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment