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 | |
| rm k8s-nodes-pods.txt &> /dev/null | |
| for node in $(kubectl get nodes | grep -v NAME | cut -d' ' -f1); do | |
| kubectl describe node "${node}" | grep -A99999 Namespace | grep -B999999 "Allocated resources:" | grep -v Allocated | grep -v Namespace | grep -v "\-\-\-\-\-" | awk '{print "'"${node}"' " $0}' >> k8s-nodes-pods.txt | |
| 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 run -it --rm --privileged docker:dind sh | |
| # Then inside the container | |
| dockerd-entrypoint.sh dockerd & | |
| DOCKER_HOST=unix:///var/run/docker.sock | |
| docker run -itd --rm redis | |
| docker ps |
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 | |
| # Render all the k8s yaml | |
| helmfile -f hello.yml template > ~/Desktop/hello.helmfile.yml | |
| # Diff the new yaml with what's actually deployed | |
| tail -n +2 ~/Desktop/hello.helmfile.yml | kubectl diff -f - > ~/Desktop/hello.helmfile.diff | |
| # If diff is acceptable, run k8s | |
| kubectl apply -f ~/Desktop/hello.helmfile.yml |
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
| strace -e open -e openat go run main.go |
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
| netstat -nr |
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: | |
| # ./svc-to-file.sh hello-world dev | |
| if [[ -z $1 ]]; then | |
| echo "ERROR: No service name provided" | |
| exit 1 | |
| fi |
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
| # https://stackoverflow.com/a/53989428 | |
| kubectl get pod | awk 'match($5,/[0-9]+d/) {print $0}' |
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
| # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_server_name | |
| # The Server Name is a TLS extention (not SSL) during the CLIENT HELLO in the init client TLS handshake for SNI. | |
| # If this frame "server_name" is missing in the CLIENT HELLO packet, the server should fail TLS | |
| # This happens with AWS Cloudfront | |
| location /path/here/ { | |
| proxy_redirect off; | |
| proxy_ssl_server_name on; | |
| proxy_pass https://proxy-site.com/path/here/; | |
| } |
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
| # Courtesy of: https://stackoverflow.com/a/11974399 | |
| {%- for item in items %} | |
| [ | |
| "{{item}}"{{ "," if not loop.last }} | |
| ] | |
| {%- endfor %} |
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
| # Courtesy of: https://stackoverflow.com/a/11974399 | |
| {%- for item in items %} | |
| [ | |
| "{{item}}"{{ "," if not loop.last }} | |
| ] | |
| {%- endfor %} |