# 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin | awk '{print $1}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl delete --ignore-not-found -f path_to_file.yaml && export CONFIG_PATH="/config.dev.yaml" && envsubst < path_to_file.yaml | kubectl create -f - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using MongoDB in golang with mgo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"net" | |
"os" | |
"os/signal" | |
"sync" | |
"syscall" | |
"time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
"sync/atomic" | |
) | |
var start time.Time |
NewerOlder