Exec as root user in Kubernetes

Hi 👋, In this short tutorial I will show you a way of getting a root shell in containers running inside a modern Kubernetes cluster. Prerequisites: Root access to the cluster node in which the container is running. Problem Statement We wan’t root access into a running container, exec gives us non-root user. 1 2 3 4 5 6 7 8 9 10 ➜ Downloads k get pods NAME READY STATUS RESTARTS AGE my-release-cassandra-0 1/1 Running 0 2m9s ➜ Downloads k exec -it pod/my-release-cassandra-0 -- /bin/bash I have no name!@my-release-cassandra-0:/$ whoami whoami: cannot find name for user ID 1001 I have no name!@my-release-cassandra-0:/$ touch test touch: cannot touch 'test': Permission denied I have no name!@my-release-cassandra-0:/$ Solution To obtain root access. First grab the Container ID from inside the pod. ...

November 19, 2022 · 2 min · Denis Nuțiu

How to identify similar images using hashing and Python

Hi 👋, In this article I would like to talk about image hashing. Image hashing algorithms are specialized hashing functions that output the hash of an image based on the image’s properties. Duplicate images output the same hash value and visually identical images output a hash value that is slightly different. To simplify 1 2 3 hash("white_cat") = "aaaa" hash("brown_cat") = "aaba" hash("car") = "xkjwe" Some use cases for image hashing are: ...

September 21, 2022 · 4 min · Denis Nuțiu

Object Pool Pattern

Hi 👋 In this article we’ll talk about the Object Pool pattern in Golang. The Object Pool pattern is a design pattern used in situations when constructing objects is a costly operation, for example building an HTTPClient or DatabaseClient object can take some time. By having a pool of resources, the resources are requested from the pool when needed and then returned when not needed so they can be reused later. ...

August 21, 2022 · 6 min · Denis Nuțiu

Go Pattern: Sorting a slice on multiple keys

Hi 👋 In this article I want to highlight a simple pattern for sorting a slice in Go on multiple keys. Given the following structure, let’s say we want to sort it in ascending order after Version, Generation and Time. 1 2 3 4 5 type TheStruct struct { Generation int Time int Version int } The way we sort slices in Go is by using the sort interface or one of the sort.Slice functions. To sort the slice after the above criteria we’ll call slice.Sort with the following function. ...

May 12, 2022 · 3 min · Denis Nuțiu

How to connect Ethernet devices to WiFi via WDS

Hi 👋, In this blog post I will show you how to connect an Ethernet only device to Wi-Fi using an extra router and the WDS functionality. I initially wanted to install the TP Link Archer T4U WiFi adapter driver on my Ubuntu 20.04 PC but unfortunately the driver is no longer supported. Since I really needed high internet speed for my PC, I decided to connect it via an Ethernet cable and buy another TP-Link router to use in WDS mode. ...

March 6, 2022 · 2 min · Denis Nuțiu

How to make RØDE audio interface work on Linux

Hi 👋, I have recently updated the firmware of my RODE audio interface from 1.12.x to 1.13, and the device was no longer working properly on Linux, it had trouble with the microphone. I found out that it was an audio sampling issue. 1 2 3 4 5 6 7 dmesg -kH [feb21 16:20] usb 1-9.3: 1:1: cannot set freq 44100 to ep 0x82 [ +0,005008] usb 1-9.3: 1:1: cannot set freq 44100 to ep 0x82 [ +0,005019] usb 1-9.3: 1:1: cannot set freq 44100 to ep 0x82 [ +0,004971] usb 1-9.3: 1:1: cannot set freq 44100 to ep 0x82 [ +0,015019] usb 1-9.3: 1:1: cannot set freq 44100 to ep 0x82 To fix it, I did the following: ...

February 21, 2022 · 2 min · Denis Nuțiu

Container log monitoring on Microk8s with Loki, Grafana and Promtail

Hi 👋 This is a short tutorial describing how to monitor your Kubernetes cluster container logs using Loki stack. But why? Because it is easier to view, filter your logs in Grafana and to store them persistently in Loki rather than viewing them in a terminal. Let’s get started! Assuming you already have Microk8s installed, enable the following addons: You can enable an add-on by running microk8s enable. Ex: microk8s enable dns ...

February 17, 2022 · 3 min · Denis Nuțiu

How to install a specific Python version on Linux

Hello, 👋 In this article I will show you how to install Python versions on Linux using the following methods: compiling from source, dead snakes ppa and pyenv. To make things easier, if you want to follow along in an environment that you can break, you can create a local Kubernetes cluster using Minikube. Next, I’m going to use the following yaml file to create an Ubuntu pod: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 apiVersion: v1 kind: Pod metadata: name: ubuntu labels: app: ubuntu spec: containers: - image: ubuntu command: - "sleep" - "604800" imagePullPolicy: IfNotPresent name: ubuntu restartPolicy: Always Save the above yaml in a file ubuntu_pod.yaml and run: ...

February 5, 2022 · 2 min · Denis Nuțiu

BME680 Home Assistant Integration

Hi 👋, In this short article I will highlight how to use the BME680 Home Assistant integration with a BME680 Sensor. Please note that I’m running Home Assistant core on Raspbian OS. Raspberry Pi Setup Before connecting the sensor, you will need to enable the I2C interface on your Raspberry Pi and install some additional tools that are useful for debugging. To enable the I2C interface execute: 1 sudo raspi-config Then go to Interfacing options->I2C and select yes. ...

January 16, 2022 · 4 min · Denis Nuțiu

How to document a project with MkDocs 📹

Hello, Welcome my third video tutorial, this time, on how to get started with MkDocs. In this video I try to give you a basic overview of MkDocs and a configuration consisting of the material theme and search plugin. Config The MkDocs configuration used in the video. ...

October 16, 2021 · 2 min · Denis Nuțiu