Blog Posts

Most Popular Blog Tags

Configuring VPA to Use Historical Metrics for Recommendations and Expose Them in Kube-state-metrics

The Vertical Pod Autoscaler (VPA) can manage both your pods’ resource requests but also recommend what the limits and requests for a pod should be. Recently, the kube-state-metrics project removed built-in support for VPA recommendation metrics, which made the VPA require additional configuration to be valuable. This blog post will cover how to configure the VPA to expose the recommendation metrics and how to visualize them in Grafana.

May 02, 2024 3 minutes

Custom Python Logging For Scrapy

Scrapy is a great web scraping framework, but it lacks a good logging setup. In this short blog post, I’ll show you how to use Structlog with Scrapy.

Ingress-Nginx Monitoring with Prometheus and Grafana

Ingress-nginx provides an easy integration with Prometheus for monitoring. However, it can be challenging to get started with monitoring Ingress-nginx and creating dashboards and alerts. Therefore, I’ve created a monitoring mixin for Ingress-nginx which will provide Prometheus alerts and Grafana dashboards focusing on Ingress-nginx.

Deploying a Django Channels ASGI Server to Kubernetes

Django channels is great for adding support of various network protocols as WebSockets, chat protocols, IoT protocols and other. It’s a great way to add real-time functionality to your Django application. To use channels however, requires you to deploy an ASGI server in production. This is a bit more complex and there are multiple flavors of ASGI servers to choose from. In this blog post I’ll show you how to deploy Django channels with Daphne and Nginx in a Kubernetes environment.

Adding a Shell to the Django Admin

Django’s admin is an amazing batteries-included addition to the Django framework. It’s a great tool for managing your data, and it is easily extendable and customizable. The same goes for Django’s ./manage.py shell command. If we were to combine these two give then it would have a great outcome, a fully interactive Django shell where you can manage your data in the admin. This was the idea behind django-admin-shellx, a Django application that provides a shell in the admin interface.

Sharing Development Secrets with the Team using Vault

My most recent projects have consisted of using a microservice architecture and multiple third party services (analytics, events etc.). For better or worse, this seems to be getting more popular, even for smaller companies and startups. Local development becomes more difficult with a microservice centric approach, not only computationally but also in terms of configuration management and infrastructure. This blog post tackles the issue of secret management in local development environments where you want to share secrets with the team, fetch secrets from a remote storage and inject secrets into the developer environment.

ArgoCD Monitoring with Prometheus and Grafana

ArgoCD has by default support for notifying when an Application does not have the desired status through triggers. For example, when an application becomes OutOfSync or Unhealthy, a notification is sent to your configured notification service (e.g. Slack). This was my initial setup, but I found it to be flaky, where networking issues between the server and controller for a couple of seconds would send many Slack messages that the Application status is unknown. An application becoming unhealthy would instantly send alerts to Slack. To resolve this I wanted interval based alerts and as usual Prometheus was the solution to this. ArgoCD provides Prometheus metrics out of the box, and alongside the metrics there’s a Grafana dashboard for ArgoCD. The dashboard is good, but the project is lacking any open source alerting. Even more so, it does not have a monitoring mixin for providing dashboards and alerts to be consumed easily.

Showcase: Using Jsonnet & Mixins to Simplify Endpoint Monitoring with Blackbox-exporter

Blackbox-exporter is a Prometheus exporter that probes endpoints and exposes metrics of the probe result. There are multiple guides on how to use the Blackbox-exporter, and we won’t go into that, but rather focus on newer things as Jsonnet as a templating language, the Kubernetes CustomResourceDefinition that comes with the Prometheus-operator and the open source monitoring mixin for the exporter. The goal of this post is to showcase the cool nits of Jsonnet and open source libraries to minimize boilerplate and utilize best practices and shared standards.

Custom Django Error Pages

Django comes with default views for 400, 403, 404 and 500 pages which is great. However, the default templates for these views are minimal - they just indicate what error it is. This blog post will walk through how to add custom templates and views for the error pages.

Django Development and Production Logging

Django comes with many great built-in features, logging is one of them. Pre-configured logging setups that vary between development (debug mode) and production environments. Easy integration to send you emails on errors, out-of-the-box support for various settings as log levels and log format. But how do you setup colorized logging, JSON logging and unified logging formats between Celery and Django, for example? Examples were hard to find and documentation was tricky to understand. Therefore, this blog post will walk through an opinionated setup on Django development and production logging using Structlog.

Shynet