Skip to content

Commit

Permalink
Merge pull request kubernetes#5254 from AntonioMeireles/add_docker_ca…
Browse files Browse the repository at this point in the history
…ching_to_CoreOS_cluster

Add Docker caching support to CoreOS' clusters.
  • Loading branch information
brendandburns committed Mar 13, 2015
2 parents cf68593 + b5a50ca commit 5326bae
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 105 deletions.
57 changes: 36 additions & 21 deletions docs/getting-started-guides/aws/cloud-configs/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ write_files:
#! /usr/bin/bash
until curl http://127.0.0.1:4001/v2/machines; do sleep 2; done
coreos:
fleet:
etcd-servers: http://localhost:4001
metadata: "role=master"
units:
- name: setup-network-environment.service
command: start
Expand Down Expand Up @@ -48,27 +51,6 @@ coreos:
--snapshot true
Restart=always
RestartSec=10s
- name: fleet.socket
command: start
content: |
[Socket]
ListenStream=/var/run/fleet.sock
- name: fleet.service
command: start
content: |
[Unit]
Description=fleet daemon
Wants=etcd.service
After=etcd.service
Wants=fleet.socket
After=fleet.socket
[Service]
Environment="FLEET_ETCD_SERVERS=http://127.0.0.1:4001"
Environment="FLEET_METADATA=role=master"
ExecStart=/usr/bin/fleetd
Restart=always
RestartSec=10s
- name: etcd-waiter.service
command: start
content: |
Expand Down Expand Up @@ -104,6 +86,39 @@ coreos:
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
- name: docker-cache.service
command: start
content: |
[Unit]
Description=Docker cache proxy
Requires=early-docker.service
After=early-docker.service
Before=early-docker.target
[Service]
Restart=always
TimeoutStartSec=0
RestartSec=5
Environment="TMPDIR=/var/tmp/"
Environment="DOCKER_HOST=unix:///var/run/early-docker.sock"
ExecStartPre=-/usr/bin/docker kill docker-registry
ExecStartPre=-/usr/bin/docker rm docker-registry
ExecStartPre=/usr/bin/docker pull quay.io/devops/docker-registry:latest
ExecStart=/usr/bin/docker run --rm --net host --name docker-registry \
-e STANDALONE=false \
-e MIRROR_SOURCE=https://registry-1.docker.io \
-e MIRROR_SOURCE_INDEX=https://index.docker.io \
-e MIRROR_TAGS_CACHE_TTL=1800 \
quay.io/devops/docker-registry:latest
- name: docker.service
drop-ins:
- name: 51-docker-mirror.conf
content: |
[Unit]
Requires=docker-cache.service
After=docker-cache.service
[Service]
Environment=DOCKER_OPTS='--registry-mirror=http://$private_ipv4:5000'
- name: kube-apiserver.service
command: start
content: |
Expand Down
34 changes: 8 additions & 26 deletions docs/getting-started-guides/aws/cloud-configs/node.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
#cloud-config

coreos:
fleet:
etcd-servers: http://<master-private-ip>:4001
metadata: "role=node"
units:
- name: etcd.service
mask: true
- name: fleet.service
command: start
content: |
[Unit]
Description=fleet daemon
Wants=fleet.socket
After=fleet.socket
[Service]
Environment="FLEET_ETCD_SERVERS=http://<master-private-ip>:4001"
Environment="FLEET_METADATA=role=node"
ExecStart=/usr/bin/fleetd
Restart=always
RestartSec=10s
- name: flannel.service
command: start
content: |
Expand All @@ -34,20 +25,11 @@ coreos:
ExecStart=/opt/bin/flanneld -etcd-endpoints http://<master-private-ip>:4001
- name: docker.service
command: start
content: |
[Unit]
After=flannel.service
Wants=flannel.service
Description=Docker Application Container Engine
Documentation=http://docs.docker.io
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=/bin/mount --make-rprivate /
ExecStart=/usr/bin/docker -d --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU} -s=overlay -H fd://
[Install]
WantedBy=multi-user.target
drop-ins:
- name: 51-docker-mirror.conf
content: |
[Service]
Environment=DOCKER_OPTS='--registry-mirror=http://<master-private-ip>:5000'
- name: setup-network-environment.service
command: start
content: |
Expand Down
57 changes: 37 additions & 20 deletions docs/getting-started-guides/coreos/cloud-configs/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ write_files:
#! /usr/bin/bash
until curl http://127.0.0.1:4001/v2/machines; do sleep 2; done
coreos:
fleet:
etcd-servers: http://localhost:4001
metadata: "role=master"
units:
- name: setup-network-environment.service
command: start
Expand Down Expand Up @@ -48,27 +51,8 @@ coreos:
--snapshot true
Restart=always
RestartSec=10s
- name: fleet.socket
command: start
content: |
[Socket]
ListenStream=/var/run/fleet.sock
- name: fleet.service
command: start
content: |
[Unit]
Description=fleet daemon
Wants=etcd.service
After=etcd.service
Wants=fleet.socket
After=fleet.socket
[Service]
Environment="FLEET_ETCD_SERVERS=http://127.0.0.1:4001"
Environment="FLEET_METADATA=role=master"
ExecStart=/usr/bin/fleetd
Restart=always
RestartSec=10s
- name: etcd-waiter.service
command: start
content: |
Expand Down Expand Up @@ -104,6 +88,39 @@ coreos:
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
- name: docker-cache.service
command: start
content: |
[Unit]
Description=Docker cache proxy
Requires=early-docker.service
After=early-docker.service
Before=early-docker.target
[Service]
Restart=always
TimeoutStartSec=0
RestartSec=5
Environment="TMPDIR=/var/tmp/"
Environment="DOCKER_HOST=unix:///var/run/early-docker.sock"
ExecStartPre=-/usr/bin/docker kill docker-registry
ExecStartPre=-/usr/bin/docker rm docker-registry
ExecStartPre=/usr/bin/docker pull quay.io/devops/docker-registry:latest
ExecStart=/usr/bin/docker run --rm --net host --name docker-registry \
-e STANDALONE=false \
-e MIRROR_SOURCE=https://registry-1.docker.io \
-e MIRROR_SOURCE_INDEX=https://index.docker.io \
-e MIRROR_TAGS_CACHE_TTL=1800 \
quay.io/devops/docker-registry:latest
- name: docker.service
drop-ins:
- name: 51-docker-mirror.conf
content: |
[Unit]
Requires=docker-cache.service
After=docker-cache.service
[Service]
Environment=DOCKER_OPTS='--registry-mirror=http://$private_ipv4:5000'
- name: kube-apiserver.service
command: start
content: |
Expand All @@ -126,7 +143,7 @@ coreos:
--logtostderr=true
Restart=always
RestartSec=10
- name: kube-controller-manager.service
- name: kube-controller-manager.service
command: start
content: |
[Unit]
Expand Down
36 changes: 9 additions & 27 deletions docs/getting-started-guides/coreos/cloud-configs/node.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
#cloud-config

coreos:
fleet:
etcd-servers: http://<master-private-ip>:4001
metadata: "role=node"
units:
- name: etcd.service
mask: true
- name: fleet.service
command: start
content: |
[Unit]
Description=fleet daemon
Wants=fleet.socket
After=fleet.socket
[Service]
Environment="FLEET_ETCD_SERVERS=http://<master-private-ip>:4001"
Environment="FLEET_METADATA=role=node"
ExecStart=/usr/bin/fleetd
Restart=always
RestartSec=10s
- name: flannel.service
command: start
content: |
[Unit]
After=network-online.target
After=network-online.target
Wants=network-online.target
Description=flannel is an etcd backed overlay network for containers
Expand All @@ -34,20 +25,11 @@ coreos:
ExecStart=/opt/bin/flanneld -etcd-endpoints http://<master-private-ip>:4001
- name: docker.service
command: start
content: |
[Unit]
After=flannel.service
Wants=flannel.service
Description=Docker Application Container Engine
Documentation=http://docs.docker.io
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=/bin/mount --make-rprivate /
ExecStart=/usr/bin/docker -d --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU} -s=overlay -H fd://
[Install]
WantedBy=multi-user.target
drop-ins:
- name: 51-docker-mirror.conf
content: |
[Service]
Environment=DOCKER_OPTS='--registry-mirror=http://<master-private-ip>:5000'
- name: setup-network-environment.service
command: start
content: |
Expand Down
40 changes: 29 additions & 11 deletions docs/getting-started-guides/coreos/cloud-configs/standalone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,40 @@ coreos:
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
- name: docker.service
- name: docker-cache.service
command: start
content: |
[Unit]
After=flannel.service
Wants=flannel.service
Description=Docker Application Container Engine
Documentation=http://docs.docker.io
Description=Docker cache proxy
Requires=early-docker.service
After=early-docker.service
Before=early-docker.target
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=/bin/mount --make-rprivate /
ExecStart=/usr/bin/docker -d --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU} -s=overlay -H fd://
[Install]
WantedBy=multi-user.target
Restart=always
TimeoutStartSec=0
RestartSec=5
Environment="TMPDIR=/var/tmp/"
Environment="DOCKER_HOST=unix:///var/run/early-docker.sock"
ExecStartPre=-/usr/bin/docker kill docker-registry
ExecStartPre=-/usr/bin/docker rm docker-registry
ExecStartPre=/usr/bin/docker pull quay.io/devops/docker-registry:latest
ExecStart=/usr/bin/docker run --rm --net host --name docker-registry \
-e STANDALONE=false \
-e MIRROR_SOURCE=https://registry-1.docker.io \
-e MIRROR_SOURCE_INDEX=https://index.docker.io \
-e MIRROR_TAGS_CACHE_TTL=1800 \
quay.io/devops/docker-registry:latest
- name: docker.service
command: start
drop-ins:
- name: 51-docker-mirror.conf
content: |
[Unit]
Requires=docker-cache.service
After=docker-cache.service
[Service]
Environment=DOCKER_OPTS='--registry-mirror=http://$private_ipv4:5000'
- name: kube-apiserver.service
command: start
content: |
Expand Down

0 comments on commit 5326bae

Please sign in to comment.