# Deploy K3S on Alpine ## Step 1: Install Alpine from ISO - Download the standard or virtual x86_64 ISO file. - Write the ISO to a USB flash drive (using a tool like Rufus) or mount it to a virtual machine (VMware, QEMU, or VirtualBox). - Boot your machine from the ISO (make sure Secure Boot is disabled in your BIOS if needed). - At the login prompt, log in as root with no password. ## Step 2: Run the Setup Script - Type the following command to start the interactive installer: **bash** ``` setup-alpine ``` Use code with caution. - Follow the prompts to configure your system: - Keymap & Variant: Select your keyboard layout (e.g., us). - Hostname: Enter a name for your machine (e.g., alpine-host). - Network: Choose your network interface (e.g., eth0) and select DHCP or configure a static IP. - Root Password: Enter and confirm a strong password for the root user. - Timezone: Select your local timezone (e.g., Asia/Singapore or UTC). - Proxy / NTP: Choose your HTTP proxy (usually none) and NTP client (e.g., chrony or busybox). - APK Mirror: Type f to automatically detect and select the fastest package mirror. - SSH Server: Choose your preferred SSH server (e.g., openssh). - Disk Installation: Select your target storage drive (e.g., sda or vda) and choose sys for a traditional full disk installation (or data/lvm if you have specific needs). - Confirm the prompt to erase the disk and write the system. - For cloned VM - Change hostname ``` $ vi /etc/hostname $ vi /etc/hhosts $ hostname -F /etc/hostname ``` - Change ip address ``` $ vi /etc/network/interface $ /etc/init.d/networking restart ``` - Renew ssh host keys ``` $ cd /etc/ssh $ rm ssh_host_* $ ssh-keygen -A ``` ## Step 3: Install Chrony ``` $ apk add chrony $ vi /etc/chrony/chrony.conf #pool pool.ntp.org iburst server 192.168.122.1 iburst $ /etc/init.d/chronyd start|restart ``` **verify** ``` chronyc sources -v chronyc tracking ``` ## Step 4: Install k3S **update-extlinux** ``` $ apk add --no-cache curl $ echo "cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0" >> /etc/fstab $ cat > /etc/cgconfig.conf < /etc/profile.d/cni.sh $ apk add iptables ``` **install k3s** ``` $ curl -sfL https://get.k3s.io | sh - ```