Siyuan's Blog

Read(); Think(); Try(); Repeat();

Journey with Kubernetes Part 1: Building a Kubernetes Raspberry Pi Cluster

Container technologies have gained huge popularity in the past few years. First there is Docker, and later comes Kubernetes. Kubernetes, simply put, allows you to build a cluster of servers that run containers. It makes decision where to schedule containers, maintains high-availability of containers, manages related services like network routing, DNS resolution, and storage, and handles many more things. I recently bought four Raspberry Pi 4 (4GB model) to build a toy Kubernetes cluster at home.

How colorschemes work in terminal

As a daily user of the terminal, I find coloring my terminal very useful and aesthetically pleasing compared to the usual black and white default theme. Personally, I’ve been using the default dark base16 theme. In particular, I’m using scripts from the base16-shell repo because I can simply add the setup to my rc file and make it work for whatever machine I’m using. I never really bothered to understand how the coloring works, it’s been pure magic to me.

Smart and transparent routing with policy-based routing

Usually when you setup a VPN connection, you notice that all your traffic is routed through the VPN. In some cases, this may not be what you want. For example, I wanted to setup a VPN server which is used only when requesting certain IPs. For other traffic, it’s routed normally with my ISP. To achieve such purpose, I found that I could use policy-based routing with WireGuard (or any other L3 VPN).

Configuring SR-IOV for Mellanox adapters

SR-IOV is a virtualization technique which allows a physical PCI-E device to spawn many virtual functions. These virtual functions appear as normal PCI-E devices and could be passed through to virtual machines. This allows the VMs to benefit from direct hardware access while allowing the underlying device to be shared. In my case, I needed to enable SR-IOV on the Mellanox InfiniBand adapters in order to build a HPC cluster on top of VMs.

Resource management in programming languages

Resource management is very important if you want to write computer programs that behave properly. Resource here refers to anything that you would need to acquire and release inside your program, such as memory, file, network socket, etc. If the resources are not managed well, it may lead to resource leakage. Therefore, we need to ensure that resources are properly released under all circumstances. In this blog, I describe a few patterns used in different programming languages for resource management.