Update README.md

install k3s on alpine
This commit is contained in:
kchou committed 2026-10-31 19:38:49 +08:00
1 parent 18b7526a09
commit bd7b0dc727
1 file changed
+105 -1
+105 -1
View File
@@ -1 +1,105 @@
# UTORRENT
# 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 <<EOF
mount {
cpuacct = /cgroup/cpuacct;
memory = /cgroup/memory;
devices = /cgroup/devices;
freezer = /cgroup/freezer;
net_cls = /cgroup/net_cls;
blkio = /cgroup/blkio;
cpuset = /cgroup/cpuset;
cpu = /cgroup/cpu;
}
EOF
$ sed -i 's/default_kernel_opts="pax_nouderef quiet rootfstype=ext4"/default_kernel_opts="pax_nouderef quiet rootfstype=ext4 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory"/g' /etc/update-extlinux.conf
$ update-extlinux
$ reboot
```
**cni-plugins**
```
$ apk add --no-cache cni-plugins --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
$ export PATH=$PATH:/usr/share/cni-plugins/bin
$ echo -e '#!/bin/sh\nexport PATH=$PATH:/usr/share/cni-plugins/bin' > /etc/profile.d/cni.sh
$ apk add iptables
```
**install k3s**
```
$ curl -sfL https://get.k3s.io | sh -
```