Kubernetes on Raspberry Pi 4 — Part 1 Install Raspberry Pi OS Lite 64-bit
I have been using Ubuntu Server 20 as the OS for my Raspberry Pi 4 where I host a k3s deployment for my home server. I flashed it on a 32GB microSD card, but I thought I should try a higher performance card. And since I am doing a fresh install I am going to try the new Raspberry Pi OS Lite 64-bit.
Flashing Raspberry Pi OS Lite on the microSD card
For flashing the microSD card I will be using Raspberry Pi Imager. The card that I am using is the SanDisk Extreme Pro with a capacity of 64GB.
- Open Raspberry Pi Imager
- 2. Click CHOOSE OS
3. Click Raspberry Pi OS (other)
4. Scroll down and click Raspberry Pi OS Lite (64-bit)
5. On the main screen click CHOOSE STORAGE
6. Click on the volume that you will use to flash the OS on
Enabling SSH
RPi Imager has e feature that allow you to set a hostname and enable SSH. You will need to go into Advanced Options by clicking the gear icon on the bottom right.
Here you can set a custom hostname and enable SSH using password or public key authentication.
You can scroll down to set the username and password that you will use for SSH. If you are using a LAN cable to connect to your router (like I am doing) you can uncheck the Configure wireless LAN box.
Click SAVE and you will return to the main screen.
On the main screen click WRITE and wait for flashing to be done.
Powering up the Raspberry
- Insert the microSD card into the RPi and connect it to a LAN port on your home router
2. Plug in the USB-C power source
3. In the meantime you can go on your router admin console and find what IP was assigned to your RPi. You should also reserve this IP, this way it will always be assigned to the RPi.
4. Give it a couple minutes and then you can SSH into the RPi. If you are on Windows you will need a SSH client like putty. From mac you can use the terminal:
ssh pi@<RPi_IP>
[Optional] Setup private key ssh
- Generate private/public key pair on the client
ssh-keygen -t rsa
Provide the path for the key pair to be stored at, for example:
~/.ssh/rpi_rsa
It is recommended to provide a passphrase when asked, but you will be asked for it each time you ssh into RPi.
At this point you should have two files at the location you provided, in my case the files are rpi_rsa and rpi_rsa.pub .
2. Copy the generated public key to the RPi
ssh-copy-id -i ~/.ssh/rpi_rsa.pub pi@<RPi_IP>
To check if the public key was copied you can ssh into the RPi and run
nano ~/.ssh/authorized_keys
You should find the content of the rpi_rsa.pub file in here.
Now you should be able to ssh without being asked for the password.