Skip to content

Instantly share code, notes, and snippets.

View mikejoh's full-sized avatar
☁️
👨🏻‍🏭🛠️

Mikael Johansson mikejoh

☁️
👨🏻‍🏭🛠️
View GitHub Profile
@mikejoh
mikejoh / docker-dhcpd.md
Last active June 2, 2024 16:16
Short guide on how to set up a Docker container as a DHCP server

Setting up a Docker container as a DHCP server

In this guide I’ve tested a number of different commands and configurations using Docker to run a container with dhcpd (+macvlan driver) to serve my clients in my home network. In the end i’ll migrate from my Windows 2012 R2 Server running DHCP to a much more lightweight Docker container (7.42 MB in total). Wow.

My home environment:

  • Firewall (Juniper)
    • I’m running IP helper for bootp which in this case means that i relay DHCP requests from various VLANs into one where i've placed my Windows 2012 R2 server. This is also where my container will live. See the FW configuration below:
@mikejoh
mikejoh / learning-k8s-with-minikube.md
Last active January 5, 2018 15:33
Learning Kubernetes (with minikube)

Learning Kubernetes

I'm running this on Mac OSX 10+!

Pre-req:

  • VirtualBox (there are other alternatives)
  • kubectl
  • minikube
  • jq
@mikejoh
mikejoh / git-config-file.md
Created January 17, 2018 08:08
A usable git config file.

git config file

  1. Add the below to the following file ~/.gitconfig
[user]
        name = <your name>
        email = <your email address>
[color]
        ui = auto
[alias]
 st = status
@mikejoh
mikejoh / my-tmux-setup.md
Last active January 9, 2022 09:43
My version of tmux (via iTerm2) on Mac OSX

tmux

Tested on Mac OSX High Sierra 10.13+ with iTerm2

Install tpm plugin manager

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

and add the following in the end of your ~/.tmux.conf, uncomment any plugins that you wont be using:

run '~/.tmux/plugins/tpm/tpm'
@mikejoh
mikejoh / jenkins-and-groovy-snippets.md
Last active April 6, 2023 15:25
Random useful Jenkins and Groovy script snippets

Jenkins Groovy good-to-have snippets

Example of printing all properties of an object

import java.lang.System
import hudson.model.*
import jenkins.model.*
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.*
@mikejoh
mikejoh / cka-preparation.md
Last active October 22, 2022 15:24
CKA preparation, random notes and one-liners.

Certified Kubernetes Administrator

Clusters

Cluster Members CNI Description
k8s 1 etcd, 1 master, 2 worker flannel
hk8s 1 etcd, 1 master, 2 worker calico
bk8s 1 etcd, 1 master, 1 worker flannel
wk8s 1 etcd, 1 master, 2 worker flannel
@mikejoh
mikejoh / gcloud-one-liners.md
Last active January 18, 2021 09:28
gcloud one-liners

gcloud one-liners

Fetch all Pod (labled backend) logs with severity error from StackDriver (parsing with jq)

gcloud logging read "resource.labels.pod_id:backend AND severity:ERROR" --order asc --format json | jq '.[].textPayload'

Stop all instances

gcloud compute instances stop $(gcloud compute instances list | grep -v "NAME" | awk '{ print $1}')
@mikejoh
mikejoh / gce-kubeadm-ubuntu-quick-start.md
Last active August 8, 2018 18:05
Get started with a Kubernetes cluster on GCE using kubeadm

Quick start guide setting up a small k8s cluster in GCE

Notes

  • We'll be running Ubuntu 18.04 instances
  • On Ubuntu 18.04 and Kubeadm 1.11.1 you can experience problems with nodes not

Step-by-step

  1. Create one master node and one worker node. Warning for wall of script below:
@mikejoh
mikejoh / tmux-one-liners.md
Last active August 8, 2018 19:35
tmux one-liners

tmux one-liners

To enter command mode in tmux do: Prefix + :

Set background color in current pane (command mode)

select-pane -P 'bg=red'

Synchronize commands across panes (command mode)

@mikejoh
mikejoh / docker-one-liners.md
Created August 20, 2018 08:15
Docker one-liners

Docker one-liners

Get a shell in a container (e.g. when failing)

docker run -ti --entrypoint /bin/bash IMAGE_NAME