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
| <p>这个手册是我转载的,准备用markdown整理下格式,感觉原来的html太乱了。</p> | |
| <p>TOC是通过python的markdown生成的,<a href="http://www.freewisdom.org/projects/python-markdown/">http://www.freewisdom.org/projects/python-markdown/</a></p> | |
| <pre><code>markdown awk.md > awk.html -x toc | |
| </code></pre> | |
| <p>以下全部内容是从 <a href="http://linuxfire.com.cn/~lily/awk.html">http://linuxfire.com.cn/~lily/awk.html</a> 转载的。</p> | |
| <div id="awktoc"> | |
| <div class="toc"> | |
| <ul> | |
| <li><a href="#awk">awk 手册</a><ul> |
| #!/bin/sh | |
| # This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch. | |
| # There are four variants that I have built: | |
| # - pre-commit: stops commits to "master" and "develop" branches. | |
| # - pre-commit-2: also includes a core.whitespace check. | |
| # - pre-commit-3: the core.whitespace check and an EOF-newline-check. | |
| # - pre-commit-4: only the core.whitespace check. | |
| # - pre-commit-5: elixir formatting check. | |
| # - pre-commit-6: prettier formatting check. | |
| # Set desired version like this before installing: |
| /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app="http://www.google.de" |
| # http://henrik.nyh.se/2008/12/git-dirty-prompt | |
| # http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
| # username@Machine ~/dev/dir[master]$ # clean working directory | |
| # username@Machine ~/dev/dir[master*]$ # dirty working directory | |
| function parse_git_dirty { | |
| [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
| } | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
| -module(xmltest). | |
| -compile(export_all). | |
| -include_lib("xmerl/include/xmerl.hrl"). | |
| %% @doc Helper function to generate XML from a data structure and print it | |
| serialize(Data) -> | |
| Xml = lists:flatten(xmerl:export_simple(Data, xmerl_xml)), | |
| io:format("~s~n", [Xml]). |
| file: g.erl | |
| -module(g). | |
| -compile(export_all). | |
| -behaviour(gen_server). | |
| -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). | |
| %%------------------------------------------------------------------- | |
| %% Public API |
| -module(broadcast). | |
| -export([start/1]). | |
| start(Port) -> | |
| {ok, AcceptSocket} = gen_tcp:listen(Port, [binary, {active, false}]), | |
| io:fwrite("Now listening for new connections"), | |
| % Process managing client connections | |
| ManagerId = spawn(fun() -> manage_clients([]) end), |
| #!/bin/bash | |
| SIG="-2" | |
| if [[ "$2" != "" ]]; then | |
| SIG="$2" | |
| fi | |
| ps -ef | grep $1 | grep -v grep | awk '{print $2}' | xargs kill $SIG |
| #!/usr/bin/env bash | |
| # Kill an Erlang process by node name | |
| # | |
| # e.g.: kill-erlang-node kred | |
| # Check usage | |
| if [ -z "$1" ]; then | |
| echo "Usage: `basename $0` NODE_NAME" | |
| exit 1 |