Skip to content

Instantly share code, notes, and snippets.

View svilenkov's full-sized avatar

Igor svilenkov

  • 0XFEEDFACF
  • Serbia
View GitHub Profile
@Lemon-le
Lemon-le / prom-k8s-request-limits.md
Created June 1, 2022 02:45 — forked from max-rocket-internet/prom-k8s-request-limits.md
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@djjudas21
djjudas21 / README.md
Created December 30, 2020 15:14
MicroK8s, Ingress and MetalLB

Ingress MetalLB

Out of the box, the MicroK8s distribution of ingress-nginx installed as the MicroK8s addon ingress binds to ports 80+443 on the node's IP address using a hostPort, as we can see here:

microk8s kubectl -n ingress describe daemonset.apps/nginx-ingress-microk8s-controller
Name:           nginx-ingress-microk8s-controller
Selector:       name=nginx-ingress-microk8s
@andrewxhill
andrewxhill / index.md
Last active June 5, 2022 13:42
Powergate Workshop

Introduction to Filecoin app building

This document: https://tinyurl.com/hackfs-pow

Slides from intro presentation: https://speakerdeck.com/andrewxhill/intro-to-filecoin-building-apps-with-powergate

In this workshop, we are going to introduce you to Filecoin through the use of the Powergate. While you can develop using Lotus or other Filecoin implementations directly, the Powergate is designed to provide the necessary abstractions to build Filecoin storage into your application. Some features of the Powergate include fast data retrieval with IPFS serving as a caching layer, deal management, multi-tenant wallet APIs, and more. The system comes set up to run locally in Docker or deploy to your servers.

We'll cover the Powergate CLI and the Powergate JavaScript Client in the two parts of the workshop. To prepare, we encourage you to install a few things before we get started.

@ilap
ilap / The_Hitchhikers_Guide_To_The_Shelley_Chapter_Three.md
Last active January 1, 2024 07:14
The Hitchhikers Guide To The Shelley - Chapter 3 - The Staking

The Hitchhiker's Guide To The Shelley - Chapter 3 - The Staking

This guide's chapter targets the pool operators for getting their head around of Shelley staking. To fully understand the staking mechanism we need to define and interpret the following key concepts:

Keys, Addresses and Certifications

@gsuberland
gsuberland / freenas_influxdb_disk_temperatures.sh
Created March 10, 2020 18:38
FreeNAS Influxdb Disk Temperature Script with NVMe Support
#!zsh
# FreeNAS Influxdb disk temperature script with NVMe support.
# For regular disks, sends the Temperature_Celsius value reported by /dev/daX and /dev/adaX devices.
# For NVMe disks, sends all temperature sensor values reported by /dev/nvmeX devices.
# Written by Graham Sutherland (gsuberland)
# https://github.com/gsuberland/
influxdb_db="graphite"
@max-rocket-internet
max-rocket-internet / prom-k8s-request-limits.md
Last active April 15, 2024 08:06
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@pydevops
pydevops / private-k8s.md
Last active February 2, 2024 03:25
how to set up kubectl on laptop for private GKE cluster and on prem private cluster

HTTP tunnel

On prem k8s cluster set up with bastion vm

  1. Create a bastion vm in your data center or in cloud with connectivity set up (usually vpn) to the on prem data center.
  2. Install tinyproxy on the bastion vm and pick a random port as it would be too easy for spam bot with default 8888, set up as systemd service according to https://nxnjz.net/2019/10/how-to-setup-a-simple-proxy-server-with-tinyproxy-debian-10-buster/. Make sure it works by validating with curl --proxy http://127.0.0.1:<tinyproxy-port> https://httpbin.org/ip. And I don't use any user authentication for proxy, so I locked down the firewall rules with my laptop IP/32.
  3. Download the kubeconfig file for the k8s cluster to your laptop
  4. From your laptop, run
HTTPS_PROXY=<bastion-external-ip>:<tinyproxy-port> KUBECONFIG=my-kubeconfig kubectl get nodes
@dino-
dino- / string-conversions.hs
Last active April 6, 2024 16:32
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-18.8 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@scarolan
scarolan / install_vault_consul.sh
Created October 18, 2018 19:37
Installs HashiCorp Vault with Consul as Storage backend
#!/bin/sh
#
# Once you have stood up your three Vault instances, run the script on each
# machine with your three IP addresses as script arguments. Put the IP address
# of the local machine *first* in the list.
#
# Once the script is complete you should be able to start Vault and Consul:
#
# systemctl start consul
# systemctl start vault
@oprypin
oprypin / instructions.md
Last active April 14, 2024 04:39
systemd user unit + timer example

Save these files as ~/.config/systemd/user/some-service-name.*

Run this now and after any modifications: systemctl --user daemon-reload

Try out the service (oneshot): systemctl --user start some-service-name

Check logs if something is wrong: journalctl -u --user-unit some-service-name

Start the timer after this user logs in: systemctl --user enable --now some-service-name.timer