Skip to content

Instantly share code, notes, and snippets.

@keyz182
Last active August 29, 2015 14:27
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 keyz182/a0a8115045388b491eeb to your computer and use it in GitHub Desktop.
Save keyz182/a0a8115045388b491eeb to your computer and use it in GitHub Desktop.
CoreOS Heat Template
heat_template_version: 2014-10-16
description: Deploy a CoreOS cluster
parameters:
count:
description: Number of CoreOS machines to deploy
type: number
default: 3
constraints:
- range:
min: 3
max: 20
description: Must be between 3 and 20 servers.
key_name:
type: string
description: Name of key-pair to be used for compute instance
flavor:
type: string
default: m1.medium
constraints:
- allowed_values:
- m1.small
- m1.medium
- m1.large
- d1.large
- m1.xlarge
description: |
Must be a valid CSCloud Compute Cloud flavour
image_id:
type: string
label: CoreOS image ID
default: 6d75f2c4-a898-4842-9fb9-4439fd528f2c
public_net_id:
type: string
label: Public network ID
description: ID of the public network to use
default: d6a726a2-14e9-42ab-bab2-07df1b418cd0
discovery_url:
type: string
label: Cluster discovery URL such as one generated from https://discovery.etcd.io/new
name:
type: string
description: Name of each CoreOS machine booted
default: CoreOS-stable
resources:
security_group:
type: OS::Neutron::SecurityGroup
properties:
description: Security Group
name: core-security-group
rules:
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: 0
port_range_max: 65535
- remote_ip_prefix: 0.0.0.0/0
protocol: udp
port_range_min: 0
port_range_max: 65535
- remote_ip_prefix: 0.0.0.0/0
protocol: icmp
private_net:
type: OS::Neutron::Net
properties:
admin_state_up: true
name: core-net
private_subnet:
type: OS::Neutron::Subnet
properties:
name: core-subnet
cidr: 192.168.10.0/24
gateway_ip: 192.168.10.1
allocation_pools:
- start: 192.168.10.20
end: 192.168.10.99
dns_nameservers: [10.239.40.2, 10.239.40.130]
enable_dhcp: true
network_id: { get_resource: private_net }
router:
type: OS::Neutron::Router
properties:
name: core-router
admin_state_up: true
router_gw:
type: OS::Neutron::RouterGateway
properties:
network_id: { get_param: public_net_id }
router_id: { get_resource: router }
router_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: router }
subnet_id: { get_resource: private_subnet }
machines:
type: "OS::Heat::ResourceGroup"
depends_on: private_net
properties:
count: { get_param: count }
resource_def:
type: OS::Nova::Server
properties:
security_groups: [{ get_resource: security_group }]
key_name: { get_param: key_name }
image: { get_param: image_id }
networks:
- network: { get_resource: private_net }
flavor: { get_param: flavor }
name:
str_replace:
template:
$name-$index
params:
$name: { get_param: name }
$index: "%index%"
user_data_format: RAW
user_data:
str_replace:
template: |
#cloud-config
coreos:
etcd:
discovery: $discovery_url$
# 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
params:
$discovery_url$: { get_param: discovery_url }
outputs:
key_pair:
description: SSH key-pair for this cluster
value: { get_param: key_name }
# Copyright 2014 Zuercher Hochschule fuer Angewandte Wissenschaften
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
heat_template_version: 2013-05-23
description: >
A simple Heat template to deploy CoreOS into an existing cluster.
parameters:
public_net_id:
type: string
label: Public Network ID
description: ID of the public network to use
default: d6a726a2-14e9-42ab-bab2-07df1b418cd0
image_id:
type: string
label: Glance Image ID
description: ID of existing Glance image to use
default: 6d75f2c4-a898-4842-9fb9-4439fd528f2c
key-pair:
type: string
label: SSH Key Pair
description: Name of the SSH Key pair to use
resources:
security_group:
type: OS::Neutron::SecurityGroup
properties:
description: Kubernetes Security Group
name: kube-secrurity-group
rules:
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: 0
port_range_max: 65535
- remote_ip_prefix: 0.0.0.0/0
protocol: udp
port_range_min: 0
port_range_max: 65535
- remote_ip_prefix: 0.0.0.0/0
protocol: icmp
private_net:
type: OS::Neutron::Net
properties:
admin_state_up: true
name: kube-net
private_subnet:
type: OS::Neutron::Subnet
properties:
name: kube-subnet
cidr: 192.168.12.0/24
gateway_ip: 192.168.12.1
allocation_pools:
- start: 192.168.12.20
end: 192.168.12.99
dns_nameservers: [10.239.40.2, 10.239.40.130]
enable_dhcp: true
network_id: { get_resource: private_net }
router:
type: OS::Neutron::Router
properties:
name: kube-router
admin_state_up: true
router_gw:
type: OS::Neutron::RouterGateway
properties:
network_id: { get_param: public_net_id }
router_id: { get_resource: router }
router_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: router }
subnet_id: { get_resource: private_subnet }
discovery_port:
type: OS::Neutron::Port
properties:
admin_state_up: true
network_id: { get_resource: private_net }
security_groups:
- { get_resource: security_group }
fixed_ips:
- ip_address: "192.168.12.10"
discovery:
type: OS::Nova::Server
properties:
name: discovery
image: { get_param: image_id }
flavor: m1.small
networks:
- port: { get_resource: discovery_port }
key_name: { get_param: key-pair }
user_data_format: RAW
user_data: |
#cloud-config
coreos:
fleet:
etcd_servers: http://127.0.0.1:4001
metadata: role=etcd
etcd:
name: etcd
addr: $private_ipv4:4001
bind-addr: 0.0.0.0
peer-addr: $private_ipv4:7001
cluster-active-size: 1
snapshot: true
units:
- name: etcd.service
command: start
master_port:
type: OS::Neutron::Port
properties:
admin_state_up: true
network_id: { get_resource: private_net }
security_groups:
- { get_resource: security_group }
master_floatingip:
type: OS::Neutron::FloatingIP
properties:
floating_network_id: { get_param: public_net_id }
port_id: { get_resource: master_port }
master:
type: OS::Nova::Server
properties:
name: master
image: { get_param: image_id }
flavor: m1.small
networks:
- port: { get_resource: master_port }
key_name: { get_param: key-pair }
user_data_format: RAW
user_data:
str_replace:
template: |
#cloud-config
coreos:
fleet:
public-ip: $private_ipv4
metadata: role=master
etcd:
discovery: http://$etcd_discovery_ip$:4001/v2/keys/cluster
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: flannel.service
command: start
content: |
[Unit]
Requires=etcd.service
After=etcd.service
[Service]
ExecStartPre=-/usr/bin/mkdir -p /opt/bin
ExecStartPre=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/flannel/flanneld
ExecStartPre=/usr/bin/chmod +x /opt/bin/flanneld
ExecStartPre=/usr/bin/etcdctl -C http://$etcd_discovery_ip$:4001 set /coreos.com/network/config '{"Network":"10.100.0.0/16"}'
ExecStart=/opt/bin/flanneld \
-etcd-endpoints http://$etcd_discovery_ip$:4001 \
-iface=$private_ipv4 \
-logtostderr=true
[Install]
WantedBy=multi-user.target
- name: docker.service
command: restart
content: |
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.io
Requires=flannel.service
After=flannel.service
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=/bin/mount --make-rprivate /
ExecStart=/usr/bin/docker -d --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
- name: download-kubernetes.service
command: start
content: |
[Unit]
After=network-online.target
Before=kube-apiserver.service
Before=controller-manager.service
Description=Download Kubernetes Binaries
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Requires=network-online.target
[Service]
ExecStart=/usr/bin/wget -N -P /tmp https://dbyz.co.uk/Public/kubernetes.tar.gz
ExecStart=/usr/bin/tar xvf /tmp/kubernetes.tar.gz -C /tmp/
ExecStart=/usr/bin/tar xvf /tmp/kubernetes/server/kubernetes-server-linux-amd64.tar.gz -C /tmp/kubernetes/server/
ExecStart=/usr/bin/mv /tmp/kubernetes/server/kubernetes/server/bin/hyperkube /opt/bin/
ExecStart=/usr/bin/mv /tmp/kubernetes/server/kubernetes/server/bin/kube-apiserver /opt/bin/
ExecStart=/usr/bin/mv /tmp/kubernetes/server/kubernetes/server/bin/kube-controller-manager /opt/bin/
ExecStart=/usr/bin/mv /tmp/kubernetes/server/kubernetes/server/bin/kube-proxy /opt/bin/
ExecStart=/usr/bin/mv /tmp/kubernetes/server/kubernetes/server/bin/kube-scheduler /opt/bin/
ExecStart=/usr/bin/mv /tmp/kubernetes/server/kubernetes/server/bin/kubectl /opt/bin/
ExecStart=/usr/bin/mv /tmp/kubernetes/server/kubernetes/server/bin/kubelet /opt/bin/
ExecStart=/usr/bin/mv /tmp/kubernetes/server/kubernetes/server/bin/kubernetes /opt/bin/
ExecStart=/usr/bin/mv /tmp/kubernetes/platforms/linux/amd64/kubectl /opt/bin
ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kube-register
ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/proxy
ExecStart=/usr/bin/chmod +x /opt/bin/kube-register
ExecStart=/usr/bin/chmod +x /opt/bin/kubectl
ExecStart=/usr/bin/chmod +x /opt/bin/hyperkube
ExecStart=/usr/bin/chmod +x /opt/bin/kube-apiserver
ExecStart=/usr/bin/chmod +x /opt/bin/kube-proxy
ExecStart=/usr/bin/chmod +x /opt/bin/kube-scheduler
ExecStart=/usr/bin/chmod +x /opt/bin/kubelet
ExecStart=/usr/bin/chmod +x /opt/bin/kubernetes
RemainAfterExit=yes
Type=oneshot
- name: kube-apiserver.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/kube-apiserver
Description=Kubernetes API Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/kube-apiserver \
--address=0.0.0.0 \
--port=8080 \
--etcd_servers=http://$etcd_discovery_ip$:4001 \
--service-cluster-ip-range=192.168.12.128/25 \
--logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- name: kube-scheduler.service
command: start
content: |
[Unit]
After=kube-apiserver.service
ConditionFileIsExecutable=/opt/bin/kube-scheduler
Description=Kubernetes Scheduler
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=kube-apiserver.service
[Service]
ExecStart=/opt/bin/kube-scheduler \
--logtostderr=true \
--master=127.0.0.1:8080
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- name: kube-controller-manager.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/controller-manager
Description=Kubernetes Controller Manager
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/kube-controller-manager \
--master=127.0.0.1:8080 \
--logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- name: kube-register.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/kube-register
Description=Kubernetes Registration Service
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/kube-register \
--metadata=role=kubernetes \
--fleet-endpoint=unix:///var/run/fleet.sock \
--api-endpoint=http://127.0.0.1:8080
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- name: proxy.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/proxy
Description=Kubernetes Proxy
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/proxy \
--master=http://127.0.0.1:8080 --logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
params:
$etcd_discovery_ip$:
get_attr: [ discovery, first_address ]
minion-1_port:
type: OS::Neutron::Port
properties:
admin_state_up: true
network_id: { get_resource: private_net }
security_groups:
- { get_resource: security_group }
fixed_ips:
- ip_address: "192.168.12.14"
minion-1:
type: OS::Nova::Server
properties:
name: minion-1
image: { get_param: image_id }
flavor: m1.medium
networks:
- port: { get_resource: minion-1_port }
key_name: { get_param: key-pair }
user_data_format: RAW
user_data:
str_replace:
template: |
#cloud-config
coreos:
etcd:
discovery: http://$etcd_discovery_ip$:4001/v2/keys/cluster
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $public_ipv4
metadata: role=kubernetes
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: flannel.service
command: start
content: |
[Unit]
Requires=etcd.service
After=etcd.service
[Service]
ExecStartPre=-/usr/bin/mkdir -p /opt/bin
ExecStartPre=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/flannel/flanneld
ExecStartPre=/usr/bin/chmod +x /opt/bin/flanneld
ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.100.0.0/16"}'
ExecStart=/opt/bin/flanneld \
-etcd-endpoints http://$etcd_discovery_ip$:4001 \
-iface=$private_ipv4 \
-logtostderr=true
- name: docker.service
command: restart
content: |
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.io
Requires=flannel.service
After=flannel.service
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=/bin/mount --make-rprivate /
ExecStart=/usr/bin/docker -d --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
- name: download-kubernetes.service
command: start
content: |
[Unit]
After=network-online.target
Before=kubelet.service
Before=proxy.service
Description=Download Kubernetes Binaries
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Requires=network-online.target
[Service]
ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubelet
ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/proxy
ExecStart=/usr/bin/chmod +x /opt/bin/kubelet
ExecStart=/usr/bin/chmod +x /opt/bin/proxy
RemainAfterExit=yes
Type=oneshot
- name: kubelet.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/kubelet
Description=Kubernetes Kubelet
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/kubelet \
--address=0.0.0.0 \
--port=10250 \
--hostname_override=$private_ipv4 \
--api-servers=http://$master_discovery_ip$:8080 \
--logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- name: proxy.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/proxy
Description=Kubernetes Proxy
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/proxy \
--master=http://$master_discovery_ip$:8080 --logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
params:
$etcd_discovery_ip$:
get_attr: [ discovery, first_address ]
$master_discovery_ip$:
get_attr: [ master, first_address ]
minion-2_port:
type: OS::Neutron::Port
properties:
admin_state_up: true
network_id: { get_resource: private_net }
security_groups:
- { get_resource: security_group }
fixed_ips:
- ip_address: "192.168.12.15"
minion-2:
type: OS::Nova::Server
properties:
name: minion-2
image: { get_param: image_id }
flavor: m1.medium
networks:
- port: { get_resource: minion-2_port }
key_name: { get_param: key-pair }
user_data_format: RAW
user_data:
str_replace:
template: |
#cloud-config
coreos:
etcd:
discovery: http://$etcd_discovery_ip$:4001/v2/keys/cluster
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $public_ipv4
metadata: role=kubernetes
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: flannel.service
command: start
content: |
[Unit]
Requires=etcd.service
After=etcd.service
[Service]
ExecStartPre=-/usr/bin/mkdir -p /opt/bin
ExecStartPre=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/flannel/flanneld
ExecStartPre=/usr/bin/chmod +x /opt/bin/flanneld
ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.100.0.0/16"}'
ExecStart=/opt/bin/flanneld \
-etcd-endpoints http://$etcd_discovery_ip$:4001 \
-iface=$private_ipv4 \
-logtostderr=true
- name: docker.service
command: restart
content: |
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.io
Requires=flannel.service
After=flannel.service
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=/bin/mount --make-rprivate /
ExecStart=/usr/bin/docker -d --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
- name: download-kubernetes.service
command: start
content: |
[Unit]
After=network-online.target
Before=kubelet.service
Before=proxy.service
Description=Download Kubernetes Binaries
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Requires=network-online.target
[Service]
ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubelet
ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/proxy
ExecStart=/usr/bin/chmod +x /opt/bin/kubelet
ExecStart=/usr/bin/chmod +x /opt/bin/proxy
RemainAfterExit=yes
Type=oneshot
- name: kubelet.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/kubelet
Description=Kubernetes Kubelet
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/kubelet \
--address=0.0.0.0 \
--port=10250 \
--hostname_override=$private_ipv4 \
--api-servers=http://$master_discovery_ip$:8080 \
--logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- name: proxy.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/proxy
Description=Kubernetes Proxy
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/proxy \
--master=http://$master_discovery_ip$:8080 --logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
params:
$etcd_discovery_ip$:
get_attr: [ discovery, first_address ]
$master_discovery_ip$:
get_attr: [ master, first_address ]
minion-3_port:
type: OS::Neutron::Port
properties:
admin_state_up: true
network_id: { get_resource: private_net }
security_groups:
- { get_resource: security_group }
fixed_ips:
- ip_address: "192.168.12.16"
minion-3:
type: OS::Nova::Server
properties:
name: minion-3
image: { get_param: image_id }
flavor: m1.medium
networks:
- port: { get_resource: minion-3_port }
key_name: { get_param: key-pair }
user_data_format: RAW
user_data:
str_replace:
template: |
#cloud-config
coreos:
etcd:
discovery: http://$etcd_discovery_ip$:4001/v2/keys/cluster
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $public_ipv4
metadata: role=kubernetes
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: flannel.service
command: start
content: |
[Unit]
Requires=etcd.service
After=etcd.service
[Service]
ExecStartPre=-/usr/bin/mkdir -p /opt/bin
ExecStartPre=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/flannel/flanneld
ExecStartPre=/usr/bin/chmod +x /opt/bin/flanneld
ExecStartPre=/usr/bin/etcdctl -C http://$etcd_discovery_ip$:4001 set /coreos.com/network/config '{"Network":"10.100.0.0/16"}'
ExecStart=/opt/bin/flanneld \
-etcd-endpoints http://$etcd_discovery_ip$:4001 \
-iface=$private_ipv4 \
-logtostderr=true
[Install]
WantedBy=multi-user.target
- name: docker.service
command: restart
content: |
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.io
Requires=flannel.service
After=flannel.service
[Service]
EnvironmentFile=/run/flannel/subnet.env
ExecStartPre=/bin/mount --make-rprivate /
ExecStart=/usr/bin/docker -d --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
- name: download-kubernetes.service
command: start
content: |
[Unit]
After=network-online.target
Before=kubelet.service
Before=proxy.service
Description=Download Kubernetes Binaries
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Requires=network-online.target
[Service]
ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubelet
ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/proxy
ExecStart=/usr/bin/chmod +x /opt/bin/kubelet
ExecStart=/usr/bin/chmod +x /opt/bin/proxy
RemainAfterExit=yes
Type=oneshot
- name: kubelet.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/kubelet
Description=Kubernetes Kubelet
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/kubelet \
--address=0.0.0.0 \
--port=10250 \
--hostname_override=$private_ipv4 \
--api-servers=http://$master_discovery_ip$:8080 \
--logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- name: proxy.service
command: start
content: |
[Unit]
After=etcd.service
After=download-kubernetes.service
ConditionFileIsExecutable=/opt/bin/proxy
Description=Kubernetes Proxy
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Wants=etcd.service
Wants=download-kubernetes.service
[Service]
ExecStart=/opt/bin/proxy \
--master=http://$master_discovery_ip$:8080 --logtostderr=true
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
params:
$etcd_discovery_ip$:
get_attr: [ discovery, first_address ]
$master_discovery_ip$:
get_attr: [ master, first_address ]
outputs:
floating_ip:
description: Public IP Address of Kubernetes master
value: { get_attr: [master_floatingip, floating_ip_address] }
key-pair:
description: SSH key-pair name for Kubernetes master
value: { get_param: key-pair }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment