Autonomous Machines & Society.

2024-07-29
Two Proxy Lists For Anonymous Web Access And Geographic Bypass

Read More

2024-07-28
Reducing Ram Usage In Browsers: Tips For Firefox

Suspend unused tabs to save RAM

enable browser.tabs.unloadOnLowMemory in about:config for Firefox

install Auto Tab Discard browser plugin

Read More

2024-07-27
Proxmox Cluster Setup

either use gui or command line

1
2
3
4
5
6
7
# run on master device
pvecm create <cluster_name>
# run on slave device
pvecm add <cluster_ip>
# check on master device
pvecm status

reference:

https://www.howtoforge.com/tutorial/how-to-configure-a-proxmox-ve-4-multi-node-cluster/

https://pve.proxmox.com/wiki/Cluster_Manager

Read More

2024-07-27
K3S Change Data Storage Path

you can configure K3S_DATA_DIR environment variable during installation


first, stop all k3s services

1
2
3
4
# run with root
systemctl stop k3s # k3s-agent otherwise
k3s-killall.sh

copy the data to new location

1
2
rsync -avh --progress /var/lib/rancher/k3s <path_to_store_data>

then modify the service file under /etc/systemd/system/k3s.service or /etc/systemd/system/k3s-agent.service, add one additional flag --data-dir <path_to_store_data> to the commandline

restart the service after done

1
2
3
systemctl daemon-reload
systemctl start k3s

Read More

2024-07-26
How To Clone And Resize Encrypted Linux Installation

copy encrypted linux install to new disk

perform a bit-by-bit clone to new disk

1
2
sudo dd if=<source_disk_device> of=<target_disk_device> bs=4M status=progress

remember to detach the old disk and enlarge the system partition on new disk


in kde partiton manager, you can resize both the encrypted partition and the root partition as well as the swap partition (install tools prompted by name)

follow the guide here to do it manually:

https://wiki.archlinux.org/title/Resizing_LVM-on-LUKS

Read More

2024-07-26
Configure Ubuntu'S Ip Range For Network Sharing With Kubernetes

Change default IP range settings for network sharing

When use network sharing along with k8s things could go wrong. Ubuntu uses 10.42.0.1/24 which interferes with k8s routing table. It has a larger metric value so the network will be shadowed.

To fix it you do not use ip route or ip addr. You use nmcli.

1
2
3
nmcli # check all connections
nmcli device modify <shared_device> ipv4.addr <non_conflict_ip_range>

Remember to unplug and replug the cable from client side.

Read More

2024-07-25
Mastering Node Selection In Kubernetes With Nodeselector, Nodename, And Kubectl Run

k8s start pod at specific node

specify nodeSelector or nodeName in Pod or VirtualMachineInstance manifest

these selectors are in the spec field

1
2
kubectl run <pod name> --image=<image name> -it --rm --overrides='{"spec":{"nodeName": "<node name>"}}' -- /bin/sh

to label a node, run:

1
2
kubectl label node <node_name> <key>=<value>

Read More

2024-07-24
Rebooting A Pod Or Vm In Kubernetes: Deletion, Scaling Down, And Using Virtctl

k8s reboot pod and vm

to reboot you need to kill the pod/vmi and recreate it, thereby all its states will be lost.

1
2
3
kubectl delete pod <pod_name>
kubectl delete vmi <vmi_name>

for vmi there is an option called soft-reboot which is absent in pods. however the vm runner pod must not exit.

1
2
virtctl soft-reboot <vmi_name>

for pod you you can scale down the replicas of deployment (recommended), or kill the pod directly.

1
2
3
kubectl scale deployment <deployment_name> --replicas=0
kubectl scale deployment <deployment_name> --replicas=<original replica num>

for vm you are supposed to use virtctl

1
2
3
4
virtctl start <vm_name>
virtctl stop <vm_name>
virtctl restart <vm_name>

Read More

2024-07-24
How To Remove X11 And Qt Dependencies For A Headless Ubuntu System

Make desktop ubuntu headless

1
2
3
4
sudo apt-get purge libx11.* libqt.*
sudo apt-get autoremove -y
sudo apt-get clean

Read More

2024-07-24
Setting Up A K8S Worker Cluster With K3S: Instructions, Configuration Files, And Automated Installation Tool

k8s worker cluster setup

k3s has different ways to form a cluster than kubeadm join.

https://docs.k3s.io/quick-start

k3s specifies the init command in /etc/systemd/system/k3s.service. (k3s-agent.service if installed as agent) usually it is k3s server.

you need to change it to k3s agent in order to join the master node, or pass additional environment variables K3S_URL=https://<node_ip>:6443 and K3S_TOKEN=<node-token> while running k3s installation script.

the node token is at /var/lib/rancher/k3s/server/node-token

the agent node still needs to configure registry mirrors at /etc/rancher/k3s/registries.yaml for successfully pulling images


k3sup can automatically install k3s cluster using ssh connection


multi server cluster setup:

https://docs.k3s.io/datastore/ha-embedded

Read More