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
| require 'rubygems' | |
| require 'rbvmomi' | |
| require 'pp' | |
| require 'alchemist' | |
| hyper = 'thunder03' | |
| vim = RbVmomi::VIM.connect :host => hyper, :user => 'root', :password => 'secret', :insecure => true | |
| # | |
| # get current time |
| #!/usr/bin/env ruby | |
| Dir.chdir File.join(__FILE__, "../..") | |
| unless ENV['EDITOR'] | |
| puts "No EDITOR found. Try:" | |
| puts "export EDITOR=vim" | |
| exit 1 | |
| end | |
| unless ARGV.count == 2 |
| #!/usr/bin/env python | |
| """ | |
| This module will bootstrap a machine using chef. The purpose of this | |
| script is actually to work with AWS Auto Scaling Groups. The user data | |
| for the Launch Configuration is set to download this script and then | |
| run it. This is also stores the results in a private gist and sends | |
| a message to logstash with the results. | |
| """ |
| # In Chef, when a resource is defined all its variables are evaluated during | |
| # compile time and the execution of the resource takes place in converge phase. | |
| # So if the value of a particular attribute is changed in converge | |
| # (and not in compile) the resource will be executed with the old value. | |
| # Example problem: | |
| # Let's consider this situation where there are two steps involved in a recipe | |
| # Step 1 is a Ruby block that changes a node attribute. Rubyblocks get executed | |
| # in converge phase | |
| # Step 2 is a Chef resource that makes use of the node attribute that was |
| #powershell | |
| Set-Location c:\chef | |
| #debugging, set to false, so don't execute run | |
| $invokeRun = $true | |
| #update these with teamcity parameters | |
| $userName = "XXXXX" | |
| $password = "XXXXX" |
| # knife cheat | |
| ## Search Examples | |
| knife search "name:ip*" | |
| knife search "platform:ubuntu*" | |
| knife search "platform:*" -a macaddress | |
| knife search "platform:ubuntu*" -a uptime | |
| knife search "platform:ubuntu*" -a virtualization.system | |
| knife search "platform:ubuntu*" -a network.default_gateway |
| require 'thor' | |
| require 'fileutils' | |
| require 'yaml' | |
| ## | |
| # common commands used to manage berks in a way that makes sense for that | |
| # Inspired by the fact that berks is a great idea that is painfully slow | |
| # when using mercurial, and thus needs to work around the prescribed workflow |
| #cloud-config | |
| coreos: | |
| units: | |
| - | |
| name: amazon-ecs-agent.service | |
| command: start | |
| runtime: true | |
| content: | | |
| [Unit] |
| { | |
| "Records": [ | |
| { | |
| "EventVersion": "1.0", | |
| "EventSubscriptionArn": "arn:aws:sns:EXAMPLE", | |
| "EventSource": "aws:sns", | |
| "Sns": { | |
| "SignatureVersion": "1", | |
| "Timestamp": "1970-01-01T00:00:00.000Z", | |
| "Signature": "EXAMPLE", |