A container for building customized CoreOS VMs from template
The VM Backdoor allows you to inject CoreOS guestinfo config after cloning a VM to customize host config. This includes an encoded cloud-config file which will basically let you customize the host however you want.
This repo can build a docker image that includes a script (makecorevm.rb) which can clone a CoreOS VM from template and inject your custom config.
-
Download a CoreOS VMware OVA and import it as a template into your datecenter https://coreos.com/os/docs/latest/booting-on-vmware.html#booting-with-vmware-esxi
-
Pull down this repo:
git clone https://github.com/mmoore0011/CoreCloner.git
-
Edit cloud-config.yml to suit your needs https://coreos.com/os/docs/latest/cloud-config.html
-
Build and run:
docker build .
docker run [IMAGE] /scripts/makecorevm.rb -o [VSphere Host] -k -u [USER] [--folder [FOLDER]] -D [DATACENTER] -p [PASSWORD] -i [IP/BITS] -g [GATEWAY] -n [NAMESERVER] --pool [RESOURCE POOL] --config [CLOUD CONFIG YML] [GUEST NAME]
For flexibility I used a lot of command-line options, which can always be scripted. Note that you must create a cloud-config for the script to use unless you want to just clone mindless copies of CoreOS
Note This container also has a shell built in. If you prefer, you can shell into it and run the script within. Both cloud-config.yml and makecorevm.rb are in /scripts
docker run [IMAGE] sh
- If the VM gets cloned properly and comes up without a config, you probably have invalid guestconfig parameters. Check the following:
- Get into a shell on the console (append coreos.autologin to grub line)
https://coreos.com/os/docs/latest/other-settings.html#adding-custom-kernel-boot-options
- sudo coreos-cloudinit --from-vmware-guestinfo
- A common cause is not specifying the ip correcly on the command line. Note that you have to specify the CIDR. Eg. 10.0.0.1/24
https://coreos.com/os/docs/latest/booting-on-vmware.html
Another practical example of doing something similar with powershell... much thanks to @robertlabrie for showing that this is possible
https://robertlabrie.wordpress.com/2015/09/27/coreos-on-vmware-using-vmware-guestinfo-api/