kubectl -n kube-system create sa nginx-ingress-controller
kubectl apply -f https://gist.github.com/mgoodness/684d91e5812d383f6cc48d420bdad5b5/raw/8ef6d0623e9273aa93f22ab2b5d5cbb40502a5aa/nginx-ingress-controller-clusterrole.yaml
kubectl -n kube-system apply -f https://gist.github.com/mgoodness/4c5ddf4cc340a7c504a01a8f9ff422cf/raw/421d2032e4a36577739b60c0e673e889c1d1c6e2/nginx-ingress-controller-role.yaml
kubectl create clusterrolebinding nginx-ingress-controller --clusterrole nginx-ingress-controller --serviceaccount=kube-system:nginx-ingress-controller
kubectl -n kube-system create rolebinding nginx-ingress-controller --role nginx-ingress-controller --serviceaccount=kube-system:nginx-ingress-controller
kubectl -n kube-system patch rc/nginx-ingress-controller -p '{"spec": {"template": {"spec": {"serviceAccountName": "nginx-ingress-controller"}}}}'
kubectl -n kube-system delete po -l app=nginx-ingress-controller
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
| k8s-api() { | |
| if [[ "$1" == "1.9" ]]; then | |
| url="https://v1-9.docs.kubernetes.io/docs/api-reference/v1.9/" | |
| else | |
| url="https://kubernetes.io/docs/reference/generated/kubernetes-api/v$1/" | |
| fi | |
| open ${url} | |
| } |
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
| find-replace() { | |
| for m in (ag --files-with-matches -- $1); do | |
| sed -i '' -e "s/$1/$2/g" $m | |
| done | |
| } |
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
| docker-rmi() { | |
| docker images \ | |
| | fzf --header-lines=1 --multi \ | |
| | awk '{print $3}' \ | |
| | xargs docker rmi ${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
| kube-context() { | |
| if [[ -n "$1" ]]; then | |
| context=$1 | |
| else | |
| context=$(kubectl config get-contexts \ | |
| | fzf --header-lines=1 --no-multi \ | |
| | awk '{if ($1!="*") print $1; else print $2 }') | |
| fi | |
| [[ -n ${context} ]] && kubectl config use-context ${context} |
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 | |
| while getopts ":u:" opt; do | |
| case "$opt" in | |
| u) | |
| username="${OPTARG}" | |
| ;; | |
| \?) | |
| echo "Invalid option: -${OPTARG}" >&2 | |
| return 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
| #!/usr/bin/env ruby | |
| # Sizes - Calculate and sort all filesizes for current folder | |
| # Includes directory sizes, colorized output | |
| # Brett Terpstra 2019 WTF License | |
| VERSION = "1.0.0" | |
| require 'shellwords' | |
| # Just including term-ansicolor by @flori and avoiding all the | |
| # rigamarole of requiring multiple files when it's not a gem... - Brett |
I have included a .env, ingress-nginx.yaml, controller-nginx.yaml, and bash script that will build your cluster and deploys everything in your folder you specifify in the parameter for the bash script parameters
To deploy from your cloud-config/staging folder and create the cluster do this:
./deploy.sh staging y
If you want to upgrade your existing app deployment, simply remove the y
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
| $ sudo nano /etc/systemd/system/startup.service | |
| [Unit] | |
| Description=Startup | |
| [Service] | |
| ExecStart=/usr/local/bin/startup.sh | |
| [Install] | |
| WantedBy=default.target |
Helper setup to edit .yaml files with Vim:
List of general purpose commands for Kubernetes management: