Skip to content

Instantly share code, notes, and snippets.

View kelseyhightower's full-sized avatar

Kelsey Hightower kelseyhightower

View GitHub Profile
Running CoreOS outside of the Cloud with iPXE
Kelsey Hightower
CoreOS runs pretty much everywhere, but running it effectively outside of the cloud can be a challenge using traditional tooling. We’ll take a look at the various ways to boot a machine via iPXE and how to leverage cloud-config to automate machine initialization.
journalctl -u etcd
-- Logs begin at Mon 2014-06-09 07:08:04 UTC, end at Mon 2014-06-09 18:28:48 UTC. --
Jun 09 07:08:04 core3.c.hightower-labs.internal etcd[3202]: [etcd] Jun 9 07:08:04.214 WARNING | [ss] Error: nil response
Jun 09 07:08:04 core3.c.hightower-labs.internal etcd[3202]: [etcd] Jun 9 07:08:04.264 WARNING | [ss] Error: nil response
Jun 09 07:08:04 core3.c.hightower-labs.internal etcd[3202]: [etcd] Jun 9 07:08:04.314 WARNING | [ss] Error: nil response
Jun 09 07:08:04 core3.c.hightower-labs.internal etcd[3202]: [etcd] Jun 9 07:08:04.364 WARNING | [ss] Error: nil response
Jun 09 07:08:04 core3.c.hightower-labs.internal etcd[3202]: [etcd] Jun 9 07:08:04.414 WARNING | [ss] Error: nil response
Jun 09 07:08:04 core3.c.hightower-labs.internal etcd[3202]: [etcd] Jun 9 07:08:04.464 WARNING | [ss] Error: nil response
Jun 09 07:08:04 core3.c.hightower-labs.internal etcd[3202]: [etcd] Jun 9 07:08:04.514 WARNING | [ss] Error: nil response
Jun 09 07:08:04 core3.c.hightower-labs.internal etcd
#!/bin/ruby
require 'yaml'
raw_data =
%Q{
apps:
appname:
workgroup1:
data:

Etcd and encrypted values

echo "password" | gpg2 --symmetric --cipher-algo aes256 | base64
jA0ECQMCrK4yLqS7y37U0j4B/LOKb/ueWmr5wws2lNVwSOorICpWwTkHDadp2epK9r2geAnTbHkCWLleotj69tf6aYz/0GEuAQIzvaRPng==
curl -X PUT -L http://127.0.0.1:4001/v2/keys/password -d value='jA0ECQMCrK4yLqS7y37U0j4B/LOKb/ueWmr5wws2lNVwSOorICpWwTkHDadp2epK9r2geAnTbHkCWLleotj69tf6aYz/0GEuAQIzvaRPng=='
2014-06-12T19:20:54-07:00 Macintosh.local ./confd[7438]: ERROR Get http://127.0.0.1:8500/v1/kv/upstream?recurse=1: EOF
2014-06-12T19:20:55-07:00 Macintosh.local ./confd[7438]: ERROR Get http://127.0.0.1:8500/v1/kv/database/host?recurse=1: net/http: transport closed before response was received
2014-06-12T19:20:56-07:00 Macintosh.local ./confd[7438]: ERROR Get http://127.0.0.1:8500/v1/kv/upstream?recurse=1: EOF
2014-06-12T19:20:57-07:00 Macintosh.local ./confd[7438]: ERROR Get http://127.0.0.1:8500/v1/kv/database/host?recurse=1: net/http: transport closed before response was received
2014-06-12T19:20:58-07:00 Macintosh.local ./confd[7438]: ERROR Get http://127.0.0.1:8500/v1/kv/upstream?recurse=1: EOF
2014-06-12T19:20:59-07:00 Macintosh.local ./confd[7438]: ERROR Get http://127.0.0.1:8500/v1/kv/database/host?recurse=1: net/http: transport closed before response was received
2014-06-12T19:21:00-07:00 Macintosh.local ./confd[7438]: ERROR Get http://127.0.0.1:8500/v1/kv/upstream?recurse=1: EOF
2014-06-12T19:21:01-
Jun 27 17:08:15 core3.c.hightower-labs.internal update_engine[21730]: [0627/170815:INFO:omaha_response_handler_action.cc(78)] Using this install plan:
Jun 27 17:08:15 core3.c.hightower-labs.internal update_engine[21730]: [0627/170815:INFO:install_plan.cc(61)] InstallPlan: , new_update, url: https://commondatastorage.googleapis.com/update-storage.core-os.net/amd64-usr/361.0.0/update.gz, payload size: 102026024, payload hash: MGeaaLrqO2JGZMkUd+sSTafD6Nok7zyeG2RZN+NdHzs=, metadata size: 0, metadata signature: , install_path: /dev/sda4, kernel_install_path: , hash_checks_mandatory: false, powerwash_required: false
Jun 27 17:08:15 core3.c.hightower-labs.internal update_engine[21730]: [0627/170815:INFO:utils.cc(654)] Setting cgroup cpu shares to 2
Jun 27 17:08:15 core3.c.hightower-labs.internal update_engine[21730]: [0627/170815:ERROR:utils.cc(118)] 0 == writer.Open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600) failed: No such file or directory
Jun 27 17:08:15 core3.c.hightower-labs.internal update_engine[21730]: [062
package main
import (
"log"
"fmt"
"path/filepath"
)
type Node struct {
Key string
#cloud-config
hostname: core0
ssh_authorized _keys:
- ssh-rsa AAAAB3NzaC1yc2...
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
name: core0
discovery: https://discovery.etcd.io/dead0b52c8704ad95ac9681b4550247e
confd -verbose -onetime -debug -node 10.240.117.51:34001
2014-07-08T22:03:54Z d5432ea2c082 confd[9]: WARNING Skipping confd config file.
2014-07-08T22:03:54Z d5432ea2c082 confd[9]: NOTICE Starting confd
2014-07-08T22:03:54Z d5432ea2c082 confd[9]: NOTICE Backend set to
2014-07-08T22:03:54Z d5432ea2c082 confd[9]: NOTICE etcd nodes set to http://10.240.117.51:34001
2014-07-08T22:03:54Z d5432ea2c082 confd[9]: DEBUG Loading template resources from confdir /etc/confd
2014-07-08T22:03:54Z d5432ea2c082 confd[9]: DEBUG Processing template resource /etc/confd/conf.d/haproxy.toml
2014-07-08T22:03:54Z d5432ea2c082 confd[9]: DEBUG Loading template resource from /etc/confd/conf.d/haproxy.toml
2014-07-08T22:03:54Z d5432ea2c082 confd[9]: DEBUG Retrieving keys from store
2014-07-08T22:03:54Z d5432ea2c082 confd[9]: DEBUG Key prefix set to /
coreos:
units:
- name: dd-agent.service
command: start
content: |
[Unit]
Description=Datadog Agent
Author=CoreOS
After=docker.service