Skip to content

Instantly share code, notes, and snippets.

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin | awk '{print $1}')
kubectl delete --ignore-not-found -f path_to_file.yaml && export CONFIG_PATH="/config.dev.yaml" && envsubst < path_to_file.yaml | kubectl create -f -
@mikemadisonweb
mikemadisonweb / install_go_env.sh
Last active March 20, 2024 11:50
Install Golang, Docker, Docker-compose and Glide
#### Golang
apt update && apt install -y wget git-core
cd /tmp
wget --no-check-certificate https://storage.googleapis.com/golang/go1.10.linux-amd64.tar.gz
tar -xzf ${GO_FILE}
mv go /usr/local/go
echo 'export PATH=$PATH:/usr/local/go/bin
export GOPATH=/var/www/go
export PATH=$PATH:$GOPATH/bin' >> /etc/profile
source /etc/profile
@mikemadisonweb
mikemadisonweb / kube-private-registry.sh
Created January 17, 2018 06:34
Resolve inconsistency with the most recent kubernetes and docker versions (may not be needed in future)
kubectl create secret -n "$KUBE_NAMESPACE" \
docker-registry gitlab-registry \
--docker-server="$CI_REGISTRY" \
--docker-username="$CI_REGISTRY_USER" \
--docker-password="$CI_REGISTRY_PASSWORD" \
--docker-email="$GITLAB_USER_EMAIL" \
-o yaml --dry-run | sed 's/dockercfg/dockerconfigjson/g' | kubectl replace -n "$KUBE_NAMESPACE" --force -f -
@mikemadisonweb
mikemadisonweb / kubectl-cs.md
Created January 15, 2018 13:08 — forked from luebken/kubectl-cs.md
Kubectl Cheatsheet
# start up a cluster
KUBERNETES_PROVIDER=vagrant ./cluster/kube-up.sh

# start a simple vagrant cluster
NUM_NODES=1 KUBERNETES_PROVIDER=vagrant KUBE_ENABLE_CLUSTER_MONITORING=none KUBE_ENABLE_CLUSTER_UI=false ./cluster/kube-up.sh

# validate cluster 
./cluster/validate-cluster.sh
kubectl cluster-info
@mikemadisonweb
mikemadisonweb / gist:6ac971ad9a136501628a1cb32368f43e
Last active January 10, 2018 12:59 — forked from jessedearing/gist:2351836
Create self-signed SSL certificate for Nginx
#!/usr/bin/env bash
usage () {
echo -e "Usage:\nself-signed-cert-gen.sh DOMAIN";
}
# Parse command line options
DOMAIN=""
while [ $# -gt 0 ]
do
case "$1" in
@mikemadisonweb
mikemadisonweb / do-while.go
Created December 11, 2017 12:01
Do while loop in Golang
// Source https://stackoverflow.com/questions/32834661/how-to-replicate-do-while-in-go/32844744#32844744
var input int
for ok := true; ok; ok = (input != 2) {
n, err := fmt.Scanln(&input)
if n < 1 || err != nil {
fmt.Println("invalid input")
break
}
switch input {
@mikemadisonweb
mikemadisonweb / .Title
Created August 29, 2017 11:47 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo
@mikemadisonweb
mikemadisonweb / grace.go
Created August 25, 2017 06:42 — forked from rcrowley/grace.go
Graceful stop in Go
package main
import (
"log"
"net"
"os"
"os/signal"
"sync"
"syscall"
"time"
@mikemadisonweb
mikemadisonweb / testUnderstandRaceCondition.go
Created August 18, 2017 07:13 — forked from crosalot/testUnderstandRaceCondition.go
Understand Race Condition with Go
package main
import (
"fmt"
"time"
"sync/atomic"
)
var start time.Time