0

I have followed the CoreOS on GCE guide.

But looks like I am having problems understanding what the user-data metadata field is, and how to get my cloud-config file to be read..

In a directory that has my cloud-config.yaml file, I ran the following command:

gcutil --project=my-proj-704 addinstance --image=projects/coreos-cloud/global/images/coreos-   stable-410-0-0-v20140902 --persistent_boot_disk --zone=europe-west1-a --machine_type=n1-standard-1 --metadata_from_file=user-data:cloud-config.yaml --permit_root_ssh aa-gce-thing

my cloud-config.yaml looks like this...

#cloud-config
users:
  - name: mgm
    groups:
      - sudo
      - docker
    ssh-authorized-keys: - ssh-rsa AAAAB3NzaC1yc2EAAAABJQ ... mgm
ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1yc2EAAAA.... core
  - ssh-rsa AAAAB3NzaC1yc2EAAAA.... mgm
coreos:
  etcd:
    # generate a new token for each unique cluster from https://discovery.etcd.io/new
    discovery: https://discovery.etcd.io/44216d6f1z...
    # multi-region and multi-cloud deployments need to use $public_ipv4
    addr: $private_ipv4:4001
    peer-addr: $private_ipv4:7001
  fleet:
        public-ip: $public_ipv4
        metadata: region=europe-west1-a
  units:
    - name: etcd.service
      command: start
    - name: fleet.service
      command: start
    - name: format-ephemeral.service
      command: start
      content: |
        [Unit]
        Description=Formats the ephemeral drive
        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStart=/usr/sbin/wipefs -f /dev/disk/by-id/scsi-0Google_PersistentDisk_docker-storage-1
        ExecStart=/usr/sbin/mkfs.btrfs -f /dev/disk/by-id/scsi-0Google_PersistentDisk_docker-storage-1
    - name: var-lib-docker.mount
      command: start
      content: |
        [Unit]
        Description=Mount ephemeral to /var/lib/docker
        Requires=format-ephemeral.service
        After=format-ephemeral.service
        Before=docker.service
        [Mount]
        What=/dev/disk/by-id/scsi-0Google_PersistentDisk_docker-storage-1
        Where=/var/lib/docker
        Type=btrfs

Nothing gets done on the CoreOS system, none of the mounts, services, etc.....

Any ideas?

Edit

Even tried a very simple file...

cloud-config

coreos:
  etcd:
    # generate a new token for each unique cluster from 
    https://discovery.etcd.io/new
    discovery: https://discovery.etcd.io/7cb8b85dea06c5041720
    # multi-region and multi-cloud deployments need to use $public_ipv4
    addr: $private_ipv4:4001
    peer-addr: $private_ipv4:7001
  units:
    - name: etcd.service
      command: start
    - name: fleet.service
       command: start

No dice....

mgmonteleone
  • 453
  • 1
  • 4
  • 7

2 Answers2

1

Your cloud-config isn't valid.

groups: needs to be nested under that user, not at the top level.

Rob
  • 431
  • 2
  • 2
  • Checked, the actual file is nested, was a MD error.... – mgmonteleone Sep 30 '14 at 11:03
  • CoreOS starts, but says Failed Units: 1 gce-coreos-cloudinit.service nothing mounted, no keys... the yaml content is in a user-data metadata field when i check the web console, perhaps it is getting munged...... – mgmonteleone Sep 30 '14 at 11:15
1

You can also check your cloud-init file before you actually send to server online.

https://coreos.com/validate/

Also you can check it on console with

sudo coreos-cloudinit -validate=true --from-file cloud-init

command