Changing Microk8s' default hostpath addon storage location

Hello everyone, This is a short guide on how to change Microk8s’ default storage path for the hostpath addon. First, ensure the addon is enabled: 1 microk8s enable hostpath-storage Then create a new directory in which you want to store volumes created in the Microk8s instance. 1 mkdir -p /var/microk8s-volumes Then create and apply the storage class yaml file: 1 2 3 4 5 6 7 8 9 kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: custom-storageclass provisioner: microk8s.io/hostpath reclaimPolicy: Retain parameters: pvDir: /var/microk8s-volumes volumeBindingMode: WaitForFirstConsumer To change the default storage class for Microk8s you need to run these commands: ...

August 9, 2024 · 1 min · Denis Nutiu

Idempotency in Your API

Introduction Idempotency is a crucial property in the world of APIs, ensuring that operations can be applied multiple times without changing the result. In this post, we’ll explore six effective strategies to achieve idempotency in your API, drawing inspiration from real-world examples and distributed systems principles. Idempotency Explained The light switch analogy is often used to explain idempotence. Consider a light switch in a room. The operation of turning the light switch on or off is idempotent. If the light is initially off and you flip the switch to turn it on, flipping it again won’t turn the light off again—it stays on. ...

November 11, 2023 · 4 min · Denis Nutiu

CAP Theorem

The CAP theorem, also known as Brewer’s theorem, is a concept in distributed computing that states that it is impossible for a distributed system to simultaneously provide all three of the following guarantees: Consistency: All nodes in the system see the same data at the same time. Availability: Every request made to the system receives a response, without guarantee that it contains the most recent version of the data. Partition tolerance: The system continues to function despite arbitrary message loss or failure of part of the system. In other words, when designing a distributed system, you can only choose two out of the three guarantees, and you have to sacrifice the third. This is because achieving all three is simply not possible in a distributed system. ...

May 9, 2023 · 2 min · Denis Nutiu, ChatGPT

Apache Cassandra Compaction

Introduction Apache Cassandra is a highly scalable and distributed NoSQL database that is designed to handle large volumes of data across multiple commodity servers. One of the key features of Cassandra is its ability to automatically manage data distribution, replication, and consistency across a cluster of nodes, providing high availability and fault tolerance. One important aspect of managing data in Cassandra is compaction. Compaction is the process of merging and removing unnecessary data from SSTables, which are the on-disk storage structures used by Cassandra. Over time, as data is written and deleted, SSTables can become fragmented and inefficient, which can impact performance and consume valuable disk space. Compaction helps to optimize the storage and access of data in Cassandra by merging multiple SSTables into a single, more efficient SSTable. ...

April 13, 2023 · 6 min · Denis Nutiu, ChatGPT

Working with Volumes in Microk8s

Introduction Hello 👋, In this quick tutorial 💻 we’ll explore how to use Volumes and PersistentVolumes with hostpath storage in Microk8s. We will deploy a simple nginx instance and mount a volume inside it that points to the ~/Downloads folder. Let’s get started! Note: The following image was generated with Stable Diffusion How-To You can follow along if you want to setup a quick deployment with a host path volume. ...

April 13, 2023 · 3 min · Denis Nuțiu

How to create a ServiceMonitor in Microk8s: Observability Tutorial

Hello, In this quick tutorial we will explore how to create a ServiceMonitor in microk8s when you have the observability addon enabled. When you enable the observability addon with: 1 microk8s enable observability It will create the obserability namespace and install the Kubernetes Prometheus Stack. 1 2 3 4 5 6 7 8 9 10 11 k get pods -n observability NAME READY STATUS RESTARTS AGE kube-prom-stack-prometheus-node-exporter-htzw9 1/1 tempo-0 2/2 Running 4 (16h ago) 27h alertmanager-kube-prom-stack-kube-prome-alertmanager-0 2/2 kube-prom-stack-kube-prome-operator-cbf896985-fb5fc 1/1 kube-prom-stack-kube-state-metrics-57c8c84df6-hflgj 1/1 kube-prom-stack-grafana-74d8979894-sjv77 3/3 prometheus-kube-prom-stack-kube-prome-prometheus-0 2/2 loki-0 1/1 loki-promtail-sg8bv 1/1 Running You will get a Grafana configured with a Prometheus data source and other data sources as well. ...

March 29, 2023 · 2 min · Denis Nuțiu

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

Apache Flink Checkpoints on S3 and S3 compatible storage

Hello, Recently someone working at Yahoo emailed me regarding an old thread I’ve started on the Apache Flink user mailing list. I’ve replied to the e-mail but also decided to turn the reply into a blog post, because it might help other people as well. Email Hi, I was able to get it working after tinkering with it. The issue was mainly a miscommunication, we didn’t formally know which authentication method we were using in AWS. We we’re using only s3:// ...

October 28, 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

Home automation with Home Assistant on Raspberry PI – Getting Started

Hi 👋 The purpose of this article is to get you started quickly with a Home Assistant on a Raspberry Pi. It’s a simple walkthrough on how to install Home Assistant and configure it so it will boot with your PI. I will use my old Raspberry PI V3 board. Flashing the Raspberry PI OS You will need a microSD card of reasonable size, I’m using a 16GB one and a USB Adapter to connect it with my PC. ...

December 23, 2021 · 4 min · Denis Nuțiu