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
| kubectl get nodes --sort-by=".status.conditions[?(@.reason == 'KubeletReady' )].lastTransitionTime" |
| docker run \ | |
| --name {{printf "%q" .Name}} \ | |
| {{- with .HostConfig}} | |
| {{- if .Privileged}} | |
| --privileged \ | |
| {{- end}} | |
| {{- if .AutoRemove}} | |
| --rm \ | |
| {{- end}} | |
| {{- if .Runtime}} |
| build | |
| Builds a job, and optionally waits until its completion. | |
| cancel-quiet-down | |
| Cancel the effect of the "quiet-down" command. | |
| clear-queue | |
| Clears the build queue | |
| connect-node | |
| Reconnect to a node | |
| copy-job | |
| Copies a job. |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| #!/usr/bin/env ruby | |
| require 'em-http-request' | |
| require 'json' | |
| servers = ["mysql01", "rabbitmq01", | |
| "riak01", "api01", "web01", | |
| "widgets01", "app01", "app02"] | |
| pending = servers.length | |
| EM.run { |
| # I got tired of uploading to /tmp then moving to the correct location, so these two convenience methods will save you a lot of time in the long run. | |
| # Helper method to upload to /tmp then use sudo to move to correct location. | |
| def put_sudo(data, to) | |
| filename = File.basename(to) | |
| to_directory = File.dirname(to) | |
| put data, "/tmp/#{filename}" | |
| run "#{sudo} mv /tmp/#{filename} #{to_directory}" | |
| end |
| require 'base64' | |
| require 'digest/md5' | |
| key = "your public key here" | |
| # first decode the key | |
| key_decoded = Base64.decode64(key) | |
| # create an md5 | |
| md5 = Digest::MD5.hexdigest(key_decoded) | |
| # convert that hash into a readable fingerprint |