Skip to content

Instantly share code, notes, and snippets.

View jostmart's full-sized avatar

jostmart

View GitHub Profile
package main
import (
"fmt"
"io/ioutil"
"net/http"
"sync"
"time"
"github.com/go-yaml/yaml"
@jostmart
jostmart / haproxy-reqrep.md
Created April 25, 2023 15:50 — forked from kamleshchandnani/haproxy-reqrep.md
Understanding "reqrep" in HA Proxy config

Let's assume we have following line in our HA proxy file:
reqrep ^([^\ :]*)\ /api/v1/api-name/(.*) \1\ /staging/path-name/\2
Here is our sample domain:
https://example.com/api/v1/api-name/

The goal here is to rewrite /api/v1/api-name/ to /staging/path-name/ leaving anything else unchanged.

Breaking the Regex and understanding in parts:
There are basically 3 parts in the regex:

| 3 x SSD i RAID5
|--------------------------------------------------------------------------------------------------------|
Command Line: C:\diskspd\amd64\diskspd.exe -c2G -w100 -b4K -F8 -r -o32 -W60 -d60 -Sh testfile.dat
Input parameters:
timespan: 1
-------------
duration: 60s
#!/usr/bin/env ansible-playbook
- name: Docker cluster wide tasks
hosts: docker
become: yes
handlers:
# reload config
- name: reload alertmanager1 configuration
uri:
@jostmart
jostmart / README.md
Created May 10, 2021 13:17 — forked from dims/README.md
Kubernetes Resources
@jostmart
jostmart / restore_rancher2_agents.md
Created May 7, 2021 11:01 — forked from superseb/restore_rancher2_agents.md
Restore Rancher 2 cluster/node agents on clusters

Restore Rancher 2 cluster/node agents on clusters

This is an unsupported scenario, see rancher/rancher#14731 when there is an official solution.

When cattle-cluster-agent and/or cattle-node-agent are accidentally deleted, or when server-url/cacerts are changed.

Generate definitions

  • Generate API token in the UI (user -> API & Keys) and save the Bearer token
  • Find the clusterid in the Rancher UI (format is c-xxxxx), its in the address bar when the cluster is selected
@jostmart
jostmart / extended-cleanup-rancher2.sh
Created May 7, 2021 11:00 — forked from superseb/extended-cleanup-rancher2.sh
Extended Rancher 2 cleanup (backup your data, use at your own risk)
#!/bin/sh
# Backup your data
# Use at your own risk
# Usage ./extended-cleanup-rancher2.sh
# Include clearing all iptables: ./extended-cleanup-rancher2.sh flush
docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)
docker volume rm $(docker volume ls -q)
for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done
cleanupdirs="/etc/ceph /etc/cni /etc/kubernetes /opt/cni /opt/rke /run/secrets/kubernetes.io /run/calico /run/flannel /var/lib/calico /var/lib/etcd /var/lib/cni /var/lib/kubelet /var/lib/rancher/rke/log /var/log/containers /var/log/pods /var/run/calico"
#!/usr/bin/expect
# Set up various other variables here ($user, $password)
set user admin
set password xxxxx30r8fd
# Skapa en fil för lagring av resultat
set outfile [open ./TELNET-RESULTS.txt w]
puts $outfile "--( start )-----------------"
@jostmart
jostmart / rancher-ha-cert-update.md
Created November 10, 2020 16:17 — forked from janeczku/rancher-ha-cert-update.md
rancher-ha-cert-update.md

Follow these steps to update the SSL certificate of the ingress in a Rancher High Availability installation or switch from the default self-signed to a custom certificate:

  1. Create or update the tls-rancher-ingress k8s secret resource with the new certificate and private key
  2. Create or update the tls-ca k8s secret resource with the root CA certificate (only required when using a private CA)
  3. Update Rancher installation using Helm CLI
  4. Reconfigure Rancher Agents to trust the new CA certificate

Detailed steps

1. Create/Update the certificate secret resource