Skip to content

Instantly share code, notes, and snippets.

View JasonvanBrackel's full-sized avatar

Jason L. van Brackel JasonvanBrackel

View GitHub Profile
@JasonvanBrackel
JasonvanBrackel / theranchcast-21-July-2020.sh
Created July 21, 2020 15:05
theranchcast-21-July-2020.sh
# Links
https://kubernetes.io/docs/tasks/tools/install-kubectl/
https://k3d.io
#!/bin/sh
k3d_version=v3.0.0
cluster_name=theranchcast
agent_count=3
cluster_api_port=6550
@JasonvanBrackel
JasonvanBrackel / K3os-packer-vagrant-virtualbox.md
Created July 11, 2019 19:50 — forked from mak3r/K3os-packer-vagrant-virtualbox.md
Build and run k3os using packer, vagrant and virtualbox

Packer and Vagrant resources to build k3os in VirtualBox

Requirements

  • packer
  • vagrant
  • virtualbox

Build and Run

  1. packer build k3os.json
  2. vagrant up
@JasonvanBrackel
JasonvanBrackel / k3s-training.md
Created July 11, 2019 15:23 — forked from mak3r/k3s-training.md
Process notes for k3s online training

Prep

  1. Generate a list of instances
  • sbin/generate-instance-list.sh -n mak3r-rancher-training-k3s > instance-ids.json
  • use a script to connect to those instances by list id
    • sbin/ssh-connect.sh -i 0 -k ~/.ssh/mak3r-private.pem -s
  1. Get the cloud server public IP address and replace throughout the script
  2. Prepare a local RPi server

@JasonvanBrackel
JasonvanBrackel / mail_merge.py
Created June 5, 2019 14:28
Google Docs mail merge of a Docs, document and a Sheets spreadsheet. Originally grabbed https://github.com/gsuitedevs/python-samples/blob/master/docs/mail-merge/docs_mail_merge.py 2019-06-05
# -*- coding: utf-8 -*-
#
# Copyright ©2018-2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@JasonvanBrackel
JasonvanBrackel / rancher_v220_etcd_maintenance.md
Created May 31, 2019 19:32 — forked from superseb/rancher_v220_etcd_maintenance.md
Rancher v2.2.0 single install etcd maintenance

Rancher v2.2.0 single install embedded etcd maintenance

This is not official documentation, have/make backups, use at your own risk.

v2.2.0 only

When etcd db size exceeds quota, it will raise an alarm and throw the error mvcc: database space exceeded.

To manually trigger this situation:

@JasonvanBrackel
JasonvanBrackel / Rancher-CLI-Bootstrap.sh
Created May 28, 2019 12:24
Katacoda Rancher Environment Bootstrap
DOMAIN=$(echo "https://[[HOST_SUBDOMAIN]]-443-[[KATACODA_HOST]].environments.katacoda.com" | sed -e 's/https:\/\///g')
currentVersion="v2.2.0"
# Download
curl -O -J -L "https://releases.rancher.com/cli2/$currentVersion/rancher-linux-amd64-$currentVersion.tar.gz"
# Untar
tar -xvzf ./"rancher-linux-amd64-$currentVersion.tar.gz"
# Copy
@JasonvanBrackel
JasonvanBrackel / import-gke-cluster.sh
Created May 23, 2019 15:36
Import a GKE Cluster into Rancher
#!/bin/sh
# Run this from withing the GKE Cloud Shell Logged in as the GKE Cluster Creator
# Service Account
serviceaccount="admin-user"
kubectl -n kube-system create serviceaccount $serviceaccount
# Cluster Role Binding
@JasonvanBrackel
JasonvanBrackel / get_kubeconfig_custom_cluster_rancher2.sh
Created January 8, 2019 16:55 — forked from superseb/get_kubeconfig_custom_cluster_rancher2.sh
Get kubeconfig for custom cluster in Rancher 2.0/2.1
#!/bin/bash
# Usage: ./get_kubeconfig_custom_cluster_rancher2.sh cluster_name
# Needs to be run on the server running `rancher/rancher` container
# 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]"
@JasonvanBrackel
JasonvanBrackel / generate_new_kubeconfig.sh
Created December 26, 2018 12:54 — forked from Oats87/generate_new_kubeconfig.sh
This bash script will sign an x509 certificate using the kube-ca located on any rancher node. This allows you to gain access back to your RKE-created kubernetes cluster should you lose the kube_config and cluster.yml for it, but still have SSH access to the hosts.
#!/bin/bash
echo "This will generate a new kube config for accessing your RKE-created kubernetes cluster. This script MUST be run on a Kubernetes node."
echo "Please enter the IP of one of your control plane hosts, followed by [ENTER]:"
read cphost
openssl genrsa -out kube-admin.key 2048
openssl req -new -sha256 -key kube-admin.key -subj "/O=system:masters/CN=kube-admin" -out kube-admin.csr
sudo openssl x509 -req -in kube-admin.csr -CA /etc/kubernetes/ssl/kube-ca.pem -CAcreateserial -CAkey /etc/kubernetes/ssl/kube-ca-key.pem -out kube-admin.crt -days 365 -sha256
sudo rm -f /etc/kubernetes/ssl/kube-ca.srl
@JasonvanBrackel
JasonvanBrackel / README.md
Created August 28, 2018 14:24 — forked from superseb/README.md
Deploy kubernetes-dashboard on Rancher 2.0 cluster exposed using NodePort

Deploy kubernetes-dashboard on Rancher 2.0 cluster exposed using NodePort

Requirements

Step 1: Generate kubeconfig from the UI

Generate the kubeconfig file for your cluster using the Kubeconfig File button in the Cluster view of your cluster. Save the generated file as $HOME/.kube/config and run kubectl get nodes to verify it works.