2

I am running CoreOS beta 991.1.0 on a Google Compute Engine instance, where cloud-config is configured via the user_data metadata variable. My cloud-config looks like this:

#cloud-config
write_files:
  - path: "/etc/kubernetes/kube.conf"
    permissions: "0644"
    owner: "root"
    content: |
      apiVersion: v1
      kind: Config
      clusters:
      - name: kube
        cluster:
          server: https://127.0.0.1:443
          certificate-authority: /etc/kubernetes/ssl/ca.pem
      users:
      - name: kubelet
        user:
          client-certificate: /etc/kubernetes/ssl/master-client.pem
          client-key: /etc/kubernetes/ssl/master-client-key.pem
      contexts:
      - context:
          cluster: kube
          user: kubelet
ssh_authorized_keys:
  - "SECRET"
coreos:
  etcd2:
    discovery: https://discovery.etcd.io/106b575a45f2abefdaea40ebba4d0d84
    initial-advertise-peer-urls: https://$private_ipv4:2380
    listen-peer-urls: https://$private_ipv4:2380
    listen-client-urls: https://0.0.0.0:2379
    advertise-client-urls: https://$private_ipv4:2379
  units:
    - name: etcd2.service
      command: start
      drop-ins:
        - name: 30-certificates.conf
          content: |
            [Service]
            # Client Env Vars
            Environment=ETCD_TRUSTED_CA_FILE=/etc/kubernetes/ssl/ca.pem
            Environment=ETCD_CERT_FILE=/etc/kubernetes/ssl/master-client.pem
            Environment=ETCD_KEY_FILE=/etc/kubernetes/ssl/master-client-key.pem
            # Peer Env Vars
            Environment=ETCD_PEER_TRUSTED_CA_FILE=/etc/kubernetes/ssl/ca.pem
            Environment=ETCD_PEER_CERT_FILE=/etc/kubernetes/ssl/master-peer.pem
            Environment=ETCD_PEER_KEY_FILE=/etc/kubernetes/ssl/master-peer-key.pem
    - name: fleet.service
      command: start
    - name: swap.service
      command: start
      content: |
        [Unit]
        Description=Turn on swap

        [Service]
        Type=oneshot
        Environment="SWAPFILE=/swap"
        RemainAfterExit=true
        ExecStartPre=/usr/sbin/losetup -f $SWAPFILE
        ExecStart=/usr/bin/sh -c "/sbin/swapon $(/usr/sbin/losetup -j $SWAPFILE | /usr/bin/cut -d : -f 1)"
        ExecStop=/usr/bin/sh -c "/sbin/swapoff $(/usr/sbin/losetup -j $SWAPFILE | /usr/bin/cut -d : -f 1)"
        ExecStopPost=/usr/bin/sh -c "/usr/sbin/losetup -d $(/usr/sbin/losetup -j $SWAPFILE | /usr/bin/cut -d : -f 1)"

        [Install]
        WantedBy=local.target

However, even though I have configured etcd2 to start on boot, it doesn't. Why won't etcd2 start automatically?

aknuds1
  • 2,085
  • 3
  • 16
  • 23

1 Answers1

1

The error was as simple as naming the GCE metadata variable user_data, while it should be user-data. I wish it were easier to debug though...

aknuds1
  • 2,085
  • 3
  • 16
  • 23