Fast k8s Context and Namespace Switching With Kubectx Kubens

kubectx and kubens are both great tools which speeds up working with multiple Kubernetes clusters. kubectx allows quickly changing context. kubens allows changing namespace in given context. kubectx With kubectl you need to type kubectl config use-context my-context With kubectx kubectx my-context If you have fzf installed, you can interactively select cluster by just writing kubectx. kubens Kubens is similar but it allows setting namespace. Instead of doing kubectl config set-context --current --namespace=my-namespace You can do...

October 25, 2024 · 1 min

Go Graceful Shutdown

Graceful shutdown is a technique used to smoothly terminate an app. It allows the clients to receive data from the app. Also it gives time for the load balancer to deregister it and not send a traffic to it. // this is not an app with graceful shutdown package main import ( "fmt" "log" "net/http" "time" ) // this request takes long time to complete func indexHandler(w http.ResponseWriter, r *http.Request) { log....

November 27, 2023 · 4 min

Healthchecks - two most important Pod endpoints - Readiness & Liveness Check with Go examples

Every application should contain at least two endpoints: readiness check, health check. Readiness check should indicate when the app is ready to serve traffic. It should allow traffic when the app is correctly initialized. For example it should wait for the database connection to be established. The connection to cache or external API as well. This probe allows to cut off the traffic in case the app is unable to handle it....

November 12, 2023 · 3 min
Deploying Unifi Controller to Kubernetes

Deploying Unifi Controller to Kubernetes

I would like to share with you my manifest to deploy Unifi Controller to my homelab k8s cluster. The config is based on this thread on unifi community forum I wanted to deploy Unifi Controller, this way to easily control config.gateway.json which can persist the non-standard config for router. Without config.gateway.json, the BGP configuration is lost after the router restart. I wanted the BGP config for MetalLB This manifest has several assumptions:...

July 22, 2023 · 3 min