Skip to content

Instantly share code, notes, and snippets.

@m3adow
Created May 4, 2016 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m3adow/02acc837fc8a9068b3883a984d161d74 to your computer and use it in GitHub Desktop.
Save m3adow/02acc837fc8a9068b3883a984d161d74 to your computer and use it in GitHub Desktop.
CoreOS cloud-configs utilising kontena 0.12 (example files)
#cloud-config
hostname: "node1"
coreos:
update:
reboot-strategy: "best-effort"
group: "alpha"
units:
- name: settimezone.service
command: start
content: |
[Unit]
Description=Set the time zone
[Service]
ExecStart=/usr/bin/timedatectl set-timezone Europe/Berlin
RemainAfterExit=yes
Type=oneshot
- name: 00-eth0.network
runtime: true
content: |
[Match]
Name=eth0
[Network]
Address=1.2.3.4/22
Gateway=1.2.3.1
write_files:
- path: "/etc/resolv.conf"
permissions: "0644"
owner: "root"
content: |
nameserver 172.17.43.1
nameserver 8.8.8.8
nameserver 8.8.4.4
#####
# Start Kontena Configuration
#####
#cloud-config
write_files:
- path: /etc/kontena-agent.env
permissions: 0600
owner: root
content: |
KONTENA_URI="https://kontena.example.org:8443"
KONTENA_TOKEN="oRqZWHtEd8YpVSqxXRDBeVjML/6SNhjQD/j2GCi9IVx/enqS3K1U/FEQZL4riA6iyfCh7TBOL0y+eZxKs/oO+g=="
KONTENA_PEER_INTERFACE=eth1
KONTENA_VERSION=latest
- path: /etc/systemd/system/docker.service.d/50-kontena.conf
content: |
[Service]
Environment='DOCKER_OPTS=--insecure-registry="10.81.0.0/19" --bip="172.17.43.1/16"'
- path: /etc/sysctl.d/99-inotify.conf
owner: root
permissions: 0644
content: |
fs.inotify.max_user_instances = 8192
coreos:
units:
- name: 01-eth.network
runtime: true
content: |
[Match]
Name=eth*
[Network]
DHCP=yes
DNS=172.17.43.1
DNS=8.8.8.8
DNS=8.8.4.4
DOMAINS=kontena.local
[DHCP]
UseDNS=false
- name: 10-weave.network
runtime: false
content: |
[Match]
Type=bridge
Name=weave*
[Network]
- name: kontena-agent.service
command: start
enable: true
content: |
[Unit]
Description=kontena-agent
After=network-online.target
After=docker.service
Description=Kontena Agent
Documentation=http://www.kontena.io/
Requires=network-online.target
Requires=docker.service
[Service]
Restart=always
RestartSec=5
EnvironmentFile=/etc/kontena-agent.env
ExecStartPre=-/usr/bin/docker stop kontena-agent
ExecStartPre=-/usr/bin/docker rm kontena-agent
ExecStartPre=/usr/bin/docker pull kontena/agent:${KONTENA_VERSION}
ExecStart=/usr/bin/docker run --name kontena-agent \
-e KONTENA_URI=${KONTENA_URI} \
-e KONTENA_TOKEN=${KONTENA_TOKEN} \
-e KONTENA_PEER_INTERFACE=${KONTENA_PEER_INTERFACE} \
-v=/var/run/docker.sock:/var/run/docker.sock \
-v=/etc/kontena-agent.env:/etc/kontena.env \
--net=host \
kontena/agent:${KONTENA_VERSION}
#cloud-config
hostname: "node2"
coreos:
update:
reboot-strategy: "best-effort"
group: "alpha"
units:
- name: settimezone.service
command: start
content: |
[Unit]
Description=Set the time zone
[Service]
ExecStart=/usr/bin/timedatectl set-timezone Europe/Berlin
RemainAfterExit=yes
Type=oneshot
- name: 00-eth0.network
runtime: true
content: |
[Match]
Name=eth0
[Network]
DHCP=no
Address=4.5.6.7/27
Gateway=4.5.6.8
write_files:
- path: "/etc/resolv.conf"
permissions: "0644"
owner: "root"
content: |
nameserver 172.17.43.1
nameserver 8.8.8.8
nameserver 8.8.4.4
#####
# Start Kontena Configuration
#####
#cloud-config
write_files:
- path: /etc/kontena-agent.env
permissions: 0600
owner: root
content: |
KONTENA_URI="https://kontena.example.org:8443"
KONTENA_TOKEN="oRqZWHtEd8YpVSqxXRDBeVjML/6SNhjQD/j2GCi9IVx/enqS3K1U/FEQZL4riA6iyfCh7TBOL0y+eZxKs/oO+g=="
KONTENA_PEER_INTERFACE=eth1
KONTENA_VERSION=latest
- path: /etc/systemd/system/docker.service.d/50-kontena.conf
content: |
[Service]
Environment='DOCKER_OPTS=--insecure-registry="10.81.0.0/19" --bip="172.17.43.1/16"'
- path: /etc/sysctl.d/99-inotify.conf
owner: root
permissions: 0644
content: |
fs.inotify.max_user_instances = 8192
coreos:
units:
- name: 01-eth.network
runtime: true
content: |
[Match]
Name=eth*
[Network]
DHCP=yes
DNS=172.17.43.1
DNS=8.8.8.8
DNS=8.8.4.4
DOMAINS=kontena.local
[DHCP]
UseDNS=false
- name: 10-weave.network
runtime: false
content: |
[Match]
Type=bridge
Name=weave*
[Network]
- name: kontena-agent.service
command: start
enable: true
content: |
[Unit]
Description=kontena-agent
After=network-online.target
After=docker.service
Description=Kontena Agent
Documentation=http://www.kontena.io/
Requires=network-online.target
Requires=docker.service
[Service]
Restart=always
RestartSec=5
EnvironmentFile=/etc/kontena-agent.env
ExecStartPre=-/usr/bin/docker stop kontena-agent
ExecStartPre=-/usr/bin/docker rm kontena-agent
ExecStartPre=/usr/bin/docker pull kontena/agent:${KONTENA_VERSION}
ExecStart=/usr/bin/docker run --name kontena-agent \
-e KONTENA_URI=${KONTENA_URI} \
-e KONTENA_TOKEN=${KONTENA_TOKEN} \
-e KONTENA_PEER_INTERFACE=${KONTENA_PEER_INTERFACE} \
-v=/var/run/docker.sock:/var/run/docker.sock \
-v=/etc/kontena-agent.env:/etc/kontena.env \
--net=host \
kontena/agent:${KONTENA_VERSION}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment