Skip to content

Instantly share code, notes, and snippets.

View ScriptingSquirrel's full-sized avatar

ScriptingSquirrel

View GitHub Profile
@ScriptingSquirrel
ScriptingSquirrel / create-lvm-raid.md
Last active August 23, 2018 20:25
Create LVM RAID (WORK IN PROGRESS)
# vgcreate test_vg /dev/sdc
# pvdisplay
# vgrename test_vg my_vg
# vgextend my_vg /dev/sdg
# pvdisplay
# lvcreate --type raid6 -i 3 -L 1G -n test_lv a_vg
# lvextend -L +128M /dev/mapper/a_vg-test_lv
# pvs
# vgs
@ScriptingSquirrel
ScriptingSquirrel / install-grub-into-all-mbrs.md
Created August 21, 2018 15:10
Install GRUB boot loader into MBR of each drive
$ for DEVICE in /dev/sd?; do sudo grub-install $DEVICE; done
@ScriptingSquirrel
ScriptingSquirrel / per-user-temporary-directory.md
Created June 18, 2018 18:52
Per-user temporary directory on Debian
@ScriptingSquirrel
ScriptingSquirrel / shrink-raid-array.md
Created June 13, 2018 19:25
Shrink existing Linux software RAID array

Current state of RAID array:

$ cat /proc/mdstat 
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md125 : active raid1 sdf4[1] sde4[0] sdg4[2]
      1922130944 blocks super 1.2 [3/3] [UUU]

unused devices: <none>
@ScriptingSquirrel
ScriptingSquirrel / software-raid.md
Last active June 6, 2018 15:33
Create Software RAID 1 array on two disks with Debian Linux

Name of the new RAID partition in this example: backup

Partition disk #1 (ata-YOURDISKID/sda in this example):

$ parted --align=optimal /dev/disk/by-id/ata-YOURDISKID

GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
@ScriptingSquirrel
ScriptingSquirrel / export-node-stats.md
Last active April 4, 2023 02:18
Setup prometheus-node-exporter and push stats to Pushgateway with cron job

(Assuming a Debian 8-like system)

  • Install prometheus-node-exporter

    $ sudo apt update && sudo apt install prometheus-node-exporter
  • Configure prometheus-node-exporter to expose metrics only to localhost, not on to all networks. Modify file /etc/default/prometheus-node-exporter:

    # Set the command-line arguments to pass to the server.
@ScriptingSquirrel
ScriptingSquirrel / install-kubernetes-dashboard-ingress-enabled.md
Last active March 4, 2022 08:48
Install Ingress-enabled kubernetes-dashboard using Helm

Problem

$ helm install kubernetes-dashboard stable/kubernetes-dashboard --namespace MY_NAMESPACE --set ingress.enabled=true --set ingress.hosts={MYDASHBOARD.EXAMPLE.COM} --set-string ingress.annotations."nginx\.ingress\.kubernetes\.io/secure-backends"="true"
Error: UPGRADE FAILED: failed to create patch: failed to get versionedObject: unable to convert unstructured object to extensions/v1beta1, Kind=Ingress: unrecognized type: string

NB: A fix for the --set-string flag is on the way: helm/helm#4142

Workaround