Skip to content

Instantly share code, notes, and snippets.

@jaohaohsuan
Last active November 23, 2016 13:32
Show Gist options
  • Select an option

  • Save jaohaohsuan/9725740f5d321e356517c0844c74b6ce to your computer and use it in GitHub Desktop.

Select an option

Save jaohaohsuan/9725740f5d321e356517c0844c74b6ce to your computer and use it in GitHub Desktop.
bootkube server containers
docker run --rm --net=host --cap-add=NET_ADMIN quay.io/coreos/dnsmasq -d -q --dhcp-range=192.168.90.20,192.168.90.30 --enable-tftp --tftp-root=/var/lib/tftpboot --dhcp-userclass=set:ipxe,iPXE --dhcp-boot=tag:#ipxe,undionly.kpxe --dhcp-boot=tag:ipxe,http://bootcfg.example.com:8080/boot.ipxe --log-queries --log-dhcp --dhcp-option=3,192.168.90.1 --address=/bootcfg.example.com/192.168.90.250
docker run -p 8080:8080 --rm -v $PWD/demo1:/var/lib/bootcfg:Z -v $PWD/demo1/groups:/var/lib/bootcfg/groups:Z quay.io/coreos/bootcfg:latest -address=0.0.0.0:8080 -log-level=debug
@jaohaohsuan
Copy link
Author

jaohaohsuan commented Nov 23, 2016

Read this

  • init
git clone https://github.com/coreos/coreos-baremetal.git
cd coreos-baremetal
  • assets
mkdir-p demo/{groups,profiles,ignition,assets}
./scripts/get-coreos stable 1185.3.0 ./demo/assets
  • groups
{
  "name": "default",
  "profile": "simple",
  "metadata": {
    "ssh_authorized_keys": [ "ssh-rsa copy to here" ]
  }
}
  • profiles

http://bootcfg.example.com:8080/ignition? params uuid &mac can match with /group/*.json

{
  "id": "simple",
  "name": "juest a demo",
  "cloud_id": "",
  "ignition_id": "simple.yaml",
  "generic_id": "",
  "boot": {
     "kernel": "/assets/coreos/1235.0.0/coreos_production_pxe.vmlinuz",
     "initrd": ["/assets/coreos/1235.0.0/coreos_production_pxe_image.cpio.gz"],
     "cmdline": {
       "coreos.config.url": "http://bootcfg.example.com:8080/ignition?uuid=${uuid}&mac=${net0/mac:hexhyp}",
       "coreos.autologin": "",
       "coreos.first_boot": "1"
     } 
   }
}
  • ignition

read ssh_authorized_keys from /group/*.json file

---
{{ if index . "ssh_authorized_keys" }}
passwd:
  users:
    - name: core
      ssh_authorized_keys:
        {{ range $element := .ssh_authorized_keys }}
        - {{$element}}
        {{end}}
{{end}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment