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
| #!/usr/bin/env bash | |
| set -Eeuo pipefail | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
| usage() { | |
| cat <<EOF | |
| Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
| ################################################################################ | |
| # Method 1: Install using rpm packages (credit to DarkMukke) | |
| # | |
| rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm | |
| rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7 | |
| # WARNING: removing vim-minimal uninstalls `sudo` if you skip the second step | |
| # make sure to at least run `yum install sudo` | |
| yum -y remove vim-minimal vim-common vim-enhanced |
| # 0 is too far from ` ;) | |
| set -g base-index 1 | |
| # Automatically set window title | |
| set-window-option -g automatic-rename on | |
| set-option -g set-titles on | |
| # color prompt | |
| set -g default-terminal "screen-256color" | |
| set -g status-keys vi |
| org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 | |
| org.eclipse.jdt.core.formatter.align_type_members_on_columns=false | |
| org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 | |
| org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 | |
| org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 | |
| org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 | |
| org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 | |
| org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 | |
| org.eclipse.jdt.core.formatter.alignment_for_assignment=0 | |
| org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 |
| "call plug#begin('~/.vim/plugged') | |
| "Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
| "Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } | |
| "call plug#end() | |
| "https://vimawesome.com/ | |
| "vim-airline | |
| "vim-fugitive | |
| "NERDTree | |
| "vim-gitgutter |
| GOCMD=go | |
| GOTEST=$(GOCMD) test | |
| GOVET=$(GOCMD) vet | |
| BINARY_NAME=example | |
| VERSION?=0.0.0 | |
| SERVICE_PORT?=3000 | |
| DOCKER_REGISTRY?= #if set it should finished by / | |
| EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true | |
| GREEN := $(shell tput -Txterm setaf 2) |
| # Put this in your ~/.gitconfig or ~/.config/git/config | |
| # Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName> | |
| [user] | |
| name = Your Full Name | |
| email = your@email.tld | |
| [color] | |
| # Enable colors in color-supporting terminals | |
| ui = auto | |
| [alias] | |
| # List available aliases |
| # install build dependencies | |
| sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel | |
| # clone and install rbenv environment | |
| cd ~ | |
| git clone git://github.com/sstephenson/rbenv.git .rbenv | |
| git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
| echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile | |
| echo 'eval "$(rbenv init -)"' >> ~/.bash_profile |
FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.