Fix Ubuntu APT Update Error After Kubernetes Package Repo Change

Kubernetes legacy package repositories (apt.kubernetes.io and yum.kubernetes.io) have been deprecated and frozen starting from September 13, 2023. It is strongly recommended to use the new package repositories hosted at pkgs.k8s.io. It is also required in order to install Kubernetes versions released after September 13, 2023. The new package repositories provide downloads for Kubernetes versions starting with v1.24.0. Ubuntu packages update will fail with 404 Not Found error if you have Kubernetes packages still point to the deprecated repositories.
Read full post

Fix Docker Container Golang Execute Format Error

Bumped into error Exec format error when tried to run a Go binary within a Docker container. The Go binary is compiled from my M2 Macbook. M2 Macbook uses ARM CPU arch. As a result the Go binary was by default complied with ARM CPU arch, which is different from the Docker image’s amd64 CPU arch. Hence the execution format error. To fix it, you can take two approaches. First, we can build the Go binary within the Docker image.
Read full post

Kubernetes Cluster Fail to Start with Error: Error getting node

After a recent power outage, my Kubernetes cluster failed to come back online. I cannot connect to kube-apiserver through kubectl anymore. Upon checking the controller node, I can see these errors with kubelet service. Feb 03 00:43:06 tom-lab1 kubelet[3475]: E0203 00:43:06.555186 3475 kubelet.go:2422] "Error getting node" err="node \"tom-lab1\" not found" Feb 03 00:43:06 tom-lab1 kubelet[3475]: E0203 00:43:06.656323 3475 kubelet.go:2422] "Error getting node" err="node \"tom-lab1\" not found" In kube-apiserver logs /var/log/container/kube-apiserver-tom-lab1_kube-system_kube-apiserver-2bec70209c1231c69a6501aea951f4ff5bed1996174028cd7e0396b2c4dc34e0.log I can see the errors below.
Read full post

Deploy Metrics-server in Kubernetes with TLS enabled

Metrics-server is one of the most common service deployed in their Kubernetes clusters. It is designed to be used for autoscaling purposes. In my case, I simply want to have a way to easily check my nodes status with kubectl top node. In this post I will walk you through the steps I took to get metrics-server deployed on a local Kubernetes cluster. There are a few interesting issues I bumped into along the way.
Read full post

Run Pihole on Kubernetes

In this post I will show how I deployed Pihole onto my local Kubernetes cluster. In compare with some other online tutorials, this deployment saves Pihole configuration onto persistent volumes, so you won’t need to reconfigure everything after pod recreation. By using LoadBalancer, original client IPs are captured correctly in my Pihole instead of seeing everything was from the Cluster IP. If you want to learn how to build your own local Kubernetes cluster, read this post.
Read full post