From 07461f9a4688363b305209fd249b083f340439c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Meireles?= Date: Fri, 13 Mar 2015 19:40:25 +0000 Subject: [PATCH 1/2] use natively packaged flannel in CoreOS' cloud-configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in the footsteps of #5254 merge earlier today and per @brendandburns comments in the PR review thread... Signed-off-by: António Meireles --- .../aws/cloud-configs/master.yaml | 34 ++++++++----------- .../aws/cloud-configs/node.yaml | 30 +++++++++------- .../coreos/cloud-configs/master.yaml | 34 ++++++++----------- .../coreos/cloud-configs/node.yaml | 27 ++++++++------- .../coreos/cloud-configs/standalone.yaml | 34 ++++++++----------- 5 files changed, 76 insertions(+), 83 deletions(-) diff --git a/docs/getting-started-guides/aws/cloud-configs/master.yaml b/docs/getting-started-guides/aws/cloud-configs/master.yaml index e96234f3934..828975eecaf 100644 --- a/docs/getting-started-guides/aws/cloud-configs/master.yaml +++ b/docs/getting-started-guides/aws/cloud-configs/master.yaml @@ -60,32 +60,28 @@ coreos: Wants=etcd.service After=etcd.service After=network-online.target - Before=flannel.service + Before=flanneld.service [Service] ExecStartPre=/usr/bin/chmod +x /opt/bin/waiter.sh ExecStart=/usr/bin/bash /opt/bin/waiter.sh RemainAfterExit=true Type=oneshot - - name: flannel.service + - name: flanneld.service command: start - content: | - [Unit] - Wants=etcd-waiter.service - After=etcd-waiter.service - Requires=etcd.service - After=etcd.service - After=network-online.target - Wants=network-online.target - Description=flannel is an etcd backed overlay network for containers - - [Service] - Type=notify - ExecStartPre=-/usr/bin/mkdir -p /opt/bin - ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/k8s/flanneld - ExecStartPre=/usr/bin/chmod +x /opt/bin/flanneld - ExecStartPre=-/usr/bin/etcdctl mk /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "vxlan"}}' - ExecStart=/opt/bin/flanneld + drop-ins: + - name: 50-network-config.conf + content: | + [Service] + ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "vxlan"}}' + ExecStart= + ExecStart=/usr/libexec/sdnotify-proxy /run/flannel/sd.sock \ + /usr/bin/docker run --net=host --privileged=true --rm \ + --volume=/run/flannel:/run/flannel \ + --env=NOTIFY_SOCKET=/run/flannel/sd.sock \ + --env-file=/run/flannel/options.env \ + --volume=${ETCD_SSL_DIR}:/etc/ssl/etcd:ro \ + quay.io/coreos/flannel:${FLANNEL_VER} /opt/bin/flanneld --ip-masq=true --iface=eth1 - name: docker-cache.service command: start content: | diff --git a/docs/getting-started-guides/aws/cloud-configs/node.yaml b/docs/getting-started-guides/aws/cloud-configs/node.yaml index 098a642bdd8..73372abc2e3 100644 --- a/docs/getting-started-guides/aws/cloud-configs/node.yaml +++ b/docs/getting-started-guides/aws/cloud-configs/node.yaml @@ -9,20 +9,24 @@ coreos: mask: true - name: fleet.service command: start - - name: flannel.service + - name: flanneld.service command: start - content: | - [Unit] - After=network-online.target - Wants=network-online.target - Description=flannel is an etcd backed overlay network for containers - - [Service] - Type=notify - ExecStartPre=-/usr/bin/mkdir -p /opt/bin - ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/k8s/flanneld - ExecStartPre=/usr/bin/chmod +x /opt/bin/flanneld - ExecStart=/opt/bin/flanneld -etcd-endpoints http://:4001 + drop-ins: + - name: 50-network-config.conf + content: | + [Service] + ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "vxlan"}}' + # as we need to turn eth1 as the default interface + # https://github.com/coreos/bugs/issues/228 is sorted + # see notes in https://github.com/coreos/flannel/pull/137 + ExecStart= + ExecStart=/usr/libexec/sdnotify-proxy /run/flannel/sd.sock \ + /usr/bin/docker run --net=host --privileged=true --rm \ + --volume=/run/flannel:/run/flannel \ + --env=NOTIFY_SOCKET=/run/flannel/sd.sock \ + --env-file=/run/flannel/options.env \ + --volume=${ETCD_SSL_DIR}:/etc/ssl/etcd:ro \ + quay.io/coreos/flannel:${FLANNEL_VER} /opt/bin/flanneld -etcd-endpoints http://:4001 --ip-masq=true --iface=eth1 - name: docker.service command: start drop-ins: diff --git a/docs/getting-started-guides/coreos/cloud-configs/master.yaml b/docs/getting-started-guides/coreos/cloud-configs/master.yaml index 5f8c71376a9..4b8d6344a46 100644 --- a/docs/getting-started-guides/coreos/cloud-configs/master.yaml +++ b/docs/getting-started-guides/coreos/cloud-configs/master.yaml @@ -62,32 +62,28 @@ coreos: Wants=etcd.service After=etcd.service After=network-online.target - Before=flannel.service + Before=flanneld.service [Service] ExecStartPre=/usr/bin/chmod +x /opt/bin/waiter.sh ExecStart=/usr/bin/bash /opt/bin/waiter.sh RemainAfterExit=true Type=oneshot - - name: flannel.service + - name: flanneld.service command: start - content: | - [Unit] - Wants=etcd-waiter.service - After=etcd-waiter.service - Requires=etcd.service - After=etcd.service - After=network-online.target - Wants=network-online.target - Description=flannel is an etcd backed overlay network for containers - - [Service] - Type=notify - ExecStartPre=-/usr/bin/mkdir -p /opt/bin - ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/k8s/flanneld - ExecStartPre=/usr/bin/chmod +x /opt/bin/flanneld - ExecStartPre=-/usr/bin/etcdctl mk /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "vxlan"}}' - ExecStart=/opt/bin/flanneld + drop-ins: + - name: 50-network-config.conf + content: | + [Service] + ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "vxlan"}}' + ExecStart= + ExecStart=/usr/libexec/sdnotify-proxy /run/flannel/sd.sock \ + /usr/bin/docker run --net=host --privileged=true --rm \ + --volume=/run/flannel:/run/flannel \ + --env=NOTIFY_SOCKET=/run/flannel/sd.sock \ + --env-file=/run/flannel/options.env \ + --volume=${ETCD_SSL_DIR}:/etc/ssl/etcd:ro \ + quay.io/coreos/flannel:${FLANNEL_VER} /opt/bin/flanneld --ip-masq=true --iface=eth1 - name: docker-cache.service command: start content: | diff --git a/docs/getting-started-guides/coreos/cloud-configs/node.yaml b/docs/getting-started-guides/coreos/cloud-configs/node.yaml index 0cd47e9c210..e2c31ff5dc6 100644 --- a/docs/getting-started-guides/coreos/cloud-configs/node.yaml +++ b/docs/getting-started-guides/coreos/cloud-configs/node.yaml @@ -9,20 +9,21 @@ coreos: mask: true - name: fleet.service command: start - - name: flannel.service + - name: flanneld.service command: start - content: | - [Unit] - After=network-online.target - Wants=network-online.target - Description=flannel is an etcd backed overlay network for containers - - [Service] - Type=notify - ExecStartPre=-/usr/bin/mkdir -p /opt/bin - ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/k8s/flanneld - ExecStartPre=/usr/bin/chmod +x /opt/bin/flanneld - ExecStart=/opt/bin/flanneld -etcd-endpoints http://:4001 + drop-ins: + - name: 50-network-config.conf + content: | + [Service] + ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "vxlan"}}' + ExecStart= + ExecStart=/usr/libexec/sdnotify-proxy /run/flannel/sd.sock \ + /usr/bin/docker run --net=host --privileged=true --rm \ + --volume=/run/flannel:/run/flannel \ + --env=NOTIFY_SOCKET=/run/flannel/sd.sock \ + --env-file=/run/flannel/options.env \ + --volume=${ETCD_SSL_DIR}:/etc/ssl/etcd:ro \ + quay.io/coreos/flannel:${FLANNEL_VER} /opt/bin/flanneld -etcd-endpoints http://:4001 --ip-masq=true --iface=eth1 - name: docker.service command: start drop-ins: diff --git a/docs/getting-started-guides/coreos/cloud-configs/standalone.yaml b/docs/getting-started-guides/coreos/cloud-configs/standalone.yaml index 58508bafa1d..7bf7a4a80fd 100644 --- a/docs/getting-started-guides/coreos/cloud-configs/standalone.yaml +++ b/docs/getting-started-guides/coreos/cloud-configs/standalone.yaml @@ -23,32 +23,28 @@ coreos: Wants=etcd.service After=etcd.service After=network-online.target - Before=flannel.service + Before=flanneld.service [Service] ExecStartPre=/usr/bin/chmod +x /opt/bin/waiter.sh ExecStart=/usr/bin/bash /opt/bin/waiter.sh RemainAfterExit=true Type=oneshot - - name: flannel.service + - name: flanneld.service command: start - content: | - [Unit] - Wants=etcd-waiter.service - After=etcd-waiter.service - Requires=etcd.service - After=etcd.service - After=network-online.target - Wants=network-online.target - Description=flannel is an etcd backed overlay network for containers - - [Service] - Type=notify - ExecStartPre=-/usr/bin/mkdir -p /opt/bin - ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/k8s/flanneld - ExecStartPre=/usr/bin/chmod +x /opt/bin/flanneld - ExecStartPre=-/usr/bin/etcdctl mk /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "vxlan"}}' - ExecStart=/opt/bin/flanneld + drop-ins: + - name: 50-network-config.conf + content: | + [Service] + ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "vxlan"}}' + ExecStart= + ExecStart=/usr/libexec/sdnotify-proxy /run/flannel/sd.sock \ + /usr/bin/docker run --net=host --privileged=true --rm \ + --volume=/run/flannel:/run/flannel \ + --env=NOTIFY_SOCKET=/run/flannel/sd.sock \ + --env-file=/run/flannel/options.env \ + --volume=${ETCD_SSL_DIR}:/etc/ssl/etcd:ro \ + quay.io/coreos/flannel:${FLANNEL_VER} /opt/bin/flanneld --ip-masq=true --iface=eth1 - name: docker-cache.service command: start content: | From 1891ba029c56080b5ee5f792da5d09d46565880e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Meireles?= Date: Mon, 16 Mar 2015 16:26:57 +0000 Subject: [PATCH 2/2] in CoreOS configs enforce that docker starts only after flanneld is running. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: António Meireles --- docs/getting-started-guides/aws/cloud-configs/master.yaml | 6 ++++-- docs/getting-started-guides/aws/cloud-configs/node.yaml | 5 +++++ .../getting-started-guides/coreos/cloud-configs/master.yaml | 6 ++++-- docs/getting-started-guides/coreos/cloud-configs/node.yaml | 5 +++++ .../coreos/cloud-configs/standalone.yaml | 6 ++++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/docs/getting-started-guides/aws/cloud-configs/master.yaml b/docs/getting-started-guides/aws/cloud-configs/master.yaml index 828975eecaf..72613a4ed25 100644 --- a/docs/getting-started-guides/aws/cloud-configs/master.yaml +++ b/docs/getting-started-guides/aws/cloud-configs/master.yaml @@ -111,8 +111,10 @@ coreos: - name: 51-docker-mirror.conf content: | [Unit] - Requires=docker-cache.service - After=docker-cache.service + # making sure that docker-cache is up and that flanneld finished + # startup, otherwise containers won't land in flannel's network... + Requires=docker-cache.service flanneld.service + After=docker-cache.service flanneld.service [Service] Environment=DOCKER_OPTS='--registry-mirror=http://$private_ipv4:5000' - name: kube-apiserver.service diff --git a/docs/getting-started-guides/aws/cloud-configs/node.yaml b/docs/getting-started-guides/aws/cloud-configs/node.yaml index 73372abc2e3..59c24c5f24f 100644 --- a/docs/getting-started-guides/aws/cloud-configs/node.yaml +++ b/docs/getting-started-guides/aws/cloud-configs/node.yaml @@ -32,6 +32,11 @@ coreos: drop-ins: - name: 51-docker-mirror.conf content: | + [Unit] + # making sure that flanneld finished startup, otherwise containers + # won't land in flannel's network... + Requires=flanneld.service + After=flanneld.service [Service] Environment=DOCKER_OPTS='--registry-mirror=http://:5000' - name: setup-network-environment.service diff --git a/docs/getting-started-guides/coreos/cloud-configs/master.yaml b/docs/getting-started-guides/coreos/cloud-configs/master.yaml index 4b8d6344a46..25fd8cee24d 100644 --- a/docs/getting-started-guides/coreos/cloud-configs/master.yaml +++ b/docs/getting-started-guides/coreos/cloud-configs/master.yaml @@ -113,8 +113,10 @@ coreos: - name: 51-docker-mirror.conf content: | [Unit] - Requires=docker-cache.service - After=docker-cache.service + # making sure that docker-cache is up and that flanneld finished + # startup, otherwise containers won't land in flannel's network... + Requires=docker-cache.service flanneld.service + After=docker-cache.service flanneld.service [Service] Environment=DOCKER_OPTS='--registry-mirror=http://$private_ipv4:5000' - name: kube-apiserver.service diff --git a/docs/getting-started-guides/coreos/cloud-configs/node.yaml b/docs/getting-started-guides/coreos/cloud-configs/node.yaml index e2c31ff5dc6..ab4d2dc08bc 100644 --- a/docs/getting-started-guides/coreos/cloud-configs/node.yaml +++ b/docs/getting-started-guides/coreos/cloud-configs/node.yaml @@ -29,6 +29,11 @@ coreos: drop-ins: - name: 51-docker-mirror.conf content: | + [Unit] + # making sure that flanneld finished startup, otherwise containers + # won't land in flannel's network... + Requires=flanneld.service + After=flanneld.service [Service] Environment=DOCKER_OPTS='--registry-mirror=http://:5000' - name: setup-network-environment.service diff --git a/docs/getting-started-guides/coreos/cloud-configs/standalone.yaml b/docs/getting-started-guides/coreos/cloud-configs/standalone.yaml index 7bf7a4a80fd..7c95ac502b7 100644 --- a/docs/getting-started-guides/coreos/cloud-configs/standalone.yaml +++ b/docs/getting-started-guides/coreos/cloud-configs/standalone.yaml @@ -75,8 +75,10 @@ coreos: - name: 51-docker-mirror.conf content: | [Unit] - Requires=docker-cache.service - After=docker-cache.service + # making sure that docker-cache is up and that flanneld finished + # startup, otherwise containers won't land in flannel's network... + Requires=docker-cache.service flanneld.service + After=docker-cache.service flanneld.service [Service] Environment=DOCKER_OPTS='--registry-mirror=http://$private_ipv4:5000' - name: kube-apiserver.service