Blog of James Brown
2024-07-29
2024-07-28
Suspend unused tabs to save RAM
enable browser.tabs.unloadOnLowMemory
in about:config
for Firefox
install Auto Tab Discard
browser plugin
2024-07-27
either use gui or command line
1 | # run on master device |
reference:
https://www.howtoforge.com/tutorial/how-to-configure-a-proxmox-ve-4-multi-node-cluster/
2024-07-27
you can configure K3S_DATA_DIR
environment variable during installation
first, stop all k3s services
1 | # run with root |
copy the data to new location
1 | 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 | systemctl daemon-reload |
2024-07-26
copy encrypted linux install to new disk
perform a bit-by-bit clone to new disk
1 | 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:
2024-07-26
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 | nmcli # check all connections |
Remember to unplug and replug the cable from client side.
2024-07-25
k8s start pod at specific node
specify nodeSelector
or nodeName
in Pod
or VirtualMachineInstance
manifest
these selectors are in the spec
field
1 | kubectl run <pod name> --image=<image name> -it --rm --overrides='{"spec":{"nodeName": "<node name>"}}' -- /bin/sh |
to label a node, run:
1 | kubectl label node <node_name> <key>=<value> |
2024-07-24
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 | kubectl delete pod <pod_name> |
for vmi there is an option called soft-reboot
which is absent in pods. however the vm runner pod must not exit.
1 | virtctl soft-reboot <vmi_name> |
for pod you you can scale down the replicas of deployment (recommended), or kill the pod directly.
1 | kubectl scale deployment <deployment_name> --replicas=0 |
for vm you are supposed to use virtctl
1 | virtctl start <vm_name> |
2024-07-24
Make desktop ubuntu headless
1 | sudo apt-get purge libx11.* libqt.* |
2024-07-24
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: