Let's look at some basic kubectl output options.
Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).
We can start with:
kubectl get no
| # maximum capability of system | |
| user@ubuntu:~$ cat /proc/sys/fs/file-max | |
| 708444 | |
| # available limit | |
| user@ubuntu:~$ ulimit -n | |
| 1024 | |
| # To increase the available limit to say 200000 | |
| user@ubuntu:~$ sudo vim /etc/sysctl.conf |
| # Handling CORS headers for handling cross-origin requests example | |
| # See https://developer.mozilla.org/en/docs/Web/HTTP/CORS | |
| # TODO: check if origin is set. If missing then do not add CORS headers | |
| # TODO: handle ports in origin | |
| # check if origin header is among allowed ones | |
| map $http_origin $cors_origin { | |
| hostnames; | |
| # all domains and subdomains for my-site.com or *.my-site.com can request contents |
| export TERM="xterm-256color" # This sets up colors properly | |
| # workaround as per https://superuser.com/questions/1222867/zsh-completion-functions-broken | |
| FPATH=$HOME/.oh-my-zsh/plugins/git:$HOME/.oh-my-zsh/functions:$HOME/.oh-my-zsh/completions:/usr/share/zsh/site-functions:/usr/share/zsh/$ZSH_VERSION/functions | |
| export FPATH | |
| # set shell | |
| export SHELL=/usr/bin/zsh |
Helper setup to edit .yaml files with Vim:
List of general purpose commands for Kubernetes management:
| #!/usr/bin/env bash | |
| # https://docs.docker.com/install/linux/docker-ce/ubuntu/ | |
| sudo apt-get install apt-transport-https ca-certificates curl software-properties-common | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" | |
| sudo apt-get update | |
| sudo apt-get install docker-ce | |
| # https://docs.docker.com/compose/install/ |