Skip to content

Instantly share code, notes, and snippets.

@jgreat
jgreat / wait_for_volume.sh
Created October 17, 2022 14:59
Azure VM wait for disk attachement.
#!/bin/bash
# wait for an azure disk attachment to happen.
set -e
disk="${1}"
disk_partition="${disk}-part1"
vg="${2}"
vol="${3}"
mount_point="${4}"
@jgreat
jgreat / idempotent.sh
Created October 16, 2022 00:12
How to create idempotent values in bash
#!/bin/bash
# Generate Pod CIDR based on 10.240.0.0/14 address space
# generate a md5 from hostname to get a generated but idempotent hex value.
idempotent_hex=$(hostname | md5sum | cut -c 1-4)
# turn this hex value into an integer "16# means base 16"
idempotent_int=$((16#$idempotent_hex))
# second octet - limit to 0-4 and add 240
@jgreat
jgreat / keybase
Created December 6, 2020 17:34
keybase proof
### Keybase proof
I hereby claim:
* I am jgreat on github.
* I am jgreat (https://keybase.io/jgreat) on keybase.
* I have a public key ASB8zG-DqpomBVT4-uTwBpV7lltl15H-RtXBoKkS7FdpPQo
To claim this, I am signing this object:

Fix agents on broken hostname/ip

Updating the Server

  1. Pick a hostname
  2. Setup DNS or /etc/hosts files so all agents can resolve the name
  3. For HA: upgrade or reinstall helm chart with new hostname/certs. Docker Container: update contiainer with new certs (see upgrade instructions) or just use the default self-signed
  4. Change the server-url setting to the new hostname (settings -> server-url)
@jgreat
jgreat / chartmuseum.yaml
Last active April 2, 2019 21:16
Vote Demo Infrastructure
# Chart Museum - Chart values.yaml
persistence:
enabled: true
# Set ingress to use cert-manager/lets encrypt for TLS
ingress:
enabled: true
annotations:
certmanager\.k8s\.io/cluster-issuer: letsencrypt-prod
hosts:
charts\.your\.domain\.com:
@jgreat
jgreat / docker.md
Last active January 13, 2020 16:45
Docker CE on RHEL 7.6

Install Prerequisite Packages

yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

Enable yum server-extras Repo

Keybase proof

I hereby claim:

  • I am jgreat on github.
  • I am jgreat (https://keybase.io/jgreat) on keybase.
  • I have a public key ASDzWeioXvs5pKiT1U3So0Lh7Ye9Xv4_QbE67XD66T89GAo

To claim this, I am signing this object:

@jgreat
jgreat / extract-kubeconfig.sh
Created September 14, 2018 01:09
Extract kubeconfig for Rancher Managed Cluster
#!/bin/bash
# This script origionally written by https://github.com/superseb
# Needs to be run in embedded kubectl of Imported cluster called local, or using the RKE generated kubeconfig
# Check if jq exists
command -v jq >/dev/null 2>&1 || { echo "jq is not installed. Exiting." >&2; exit 1; }
# Check if clustername is given
if [ -z "$1" ]; then
echo "Usage: $0 [clustername]"
@jgreat
jgreat / rancher-mirror-images.sh
Created August 23, 2018 00:19
rancher ha air-gap
#!/bin/sh
IMAGES=`cat rancher-images.txt`
for IMAGE in $IMAGES; do
until docker inspect $IMAGE > /dev/null 2>&1; do
docker pull $IMAGE
done
docker tag $IMAGE jgreat-test-airgap-registry.rancher.space/$IMAGE
docker push jgreat-test-airgap-registry.rancher.space/$IMAGE
done
@jgreat
jgreat / dr.md
Last active July 17, 2018 11:31
Rancher 2.0 DR Test

Create snapshots and copy to localhost.

rke etcd snapshot-save --name test.db

export SOURCE=52.15.238.179

scp ubuntu@${SOURCE}:/opt/rke/etcd-snapshots/test.db ../../
scp ubuntu@${SOURCE}:/opt/rke/etcd-snapshots/pki.bundle.tar.gz ../../