278 lines
7.8 KiB
YAML
278 lines
7.8 KiB
YAML
heat_template_version: 2013-05-23
|
|
|
|
description: >
|
|
This template will boot a Kubernetes cluster with one or more
|
|
minions (as specified by the number_of_minions parameter, which
|
|
defaults to 1).
|
|
|
|
parameters:
|
|
|
|
ssh_key_name:
|
|
type: string
|
|
description: name of ssh key to be provisioned on our server
|
|
|
|
external_network:
|
|
type: string
|
|
description: uuid/name of a network to use for floating ip addresses
|
|
default: public
|
|
|
|
server_image:
|
|
type: string
|
|
description: glance image used to boot the server
|
|
|
|
master_flavor:
|
|
type: string
|
|
default: m1.small
|
|
description: flavor to use when booting the server
|
|
|
|
minion_flavor:
|
|
type: string
|
|
default: m1.small
|
|
description: flavor to use when booting the server
|
|
|
|
dns_nameserver:
|
|
type: string
|
|
description: address of a dns nameserver reachable in your environment
|
|
default: 8.8.8.8
|
|
|
|
number_of_masters:
|
|
type: string
|
|
description: how many kubernetes masters to spawn
|
|
default: 1
|
|
|
|
number_of_minions:
|
|
type: string
|
|
description: how many kubernetes minions to spawn
|
|
default: 1
|
|
|
|
fixed_network_cidr:
|
|
type: string
|
|
description: network range for fixed ip network
|
|
default: 10.0.0.0/24
|
|
|
|
portal_network_cidr:
|
|
type: string
|
|
description: >
|
|
address range used by kubernetes for service portals
|
|
default: 10.254.0.0/16
|
|
|
|
flannel_network_cidr:
|
|
type: string
|
|
description: network range for flannel overlay network
|
|
default: 10.100.0.0/16
|
|
|
|
flannel_network_subnetlen:
|
|
type: string
|
|
description: size of subnet assigned to each minion
|
|
default: 24
|
|
|
|
flannel_use_vxlan:
|
|
type: string
|
|
description: >
|
|
if true use the vxlan backend, otherwise use the default
|
|
udp backend
|
|
default: "false"
|
|
constraints:
|
|
- allowed_values: ["true", "false"]
|
|
|
|
kube_allow_priv:
|
|
type: string
|
|
description: >
|
|
whether or not kubernetes should permit privileged containers.
|
|
default: "true"
|
|
constraints:
|
|
- allowed_values: ["true", "false"]
|
|
|
|
docker_volume_size:
|
|
type: number
|
|
description: >
|
|
size of a cinder volume to allocate to docker for container/image
|
|
storage
|
|
default: 25
|
|
|
|
wait_condition_timeout:
|
|
type: number
|
|
description: >
|
|
timeout for the Wait Conditions
|
|
default: 6000
|
|
|
|
minions_to_remove:
|
|
type: comma_delimited_list
|
|
description: >
|
|
List of minions to be removed when doing an update. Individual minion may
|
|
be referenced several ways: (1) The resource name (e.g. ['1', '3']),
|
|
(2) The private IP address ['10.0.0.4', '10.0.0.6']. Note: the list should
|
|
be empty when doing an create.
|
|
default: []
|
|
|
|
discovery_url:
|
|
type: string
|
|
description: >
|
|
Discovery URL used for bootstrapping the etcd cluster.
|
|
|
|
resources:
|
|
|
|
######################################################################
|
|
#
|
|
# network resources. allocate a network and router for our server.
|
|
#
|
|
|
|
fixed_network:
|
|
type: OS::Neutron::Net
|
|
|
|
fixed_subnet:
|
|
type: OS::Neutron::Subnet
|
|
properties:
|
|
cidr: {get_param: fixed_network_cidr}
|
|
network: {get_resource: fixed_network}
|
|
dns_nameservers:
|
|
- {get_param: dns_nameserver}
|
|
|
|
extrouter:
|
|
type: OS::Neutron::Router
|
|
properties:
|
|
external_gateway_info:
|
|
network: {get_param: external_network}
|
|
|
|
extrouter_inside:
|
|
type: OS::Neutron::RouterInterface
|
|
properties:
|
|
router_id: {get_resource: extrouter}
|
|
subnet: {get_resource: fixed_subnet}
|
|
|
|
######################################################################
|
|
#
|
|
# load balancers.
|
|
#
|
|
|
|
api_monitor:
|
|
type: OS::Neutron::HealthMonitor
|
|
properties:
|
|
type: TCP
|
|
delay: 5
|
|
max_retries: 5
|
|
timeout: 5
|
|
|
|
api_pool:
|
|
type: OS::Neutron::Pool
|
|
properties:
|
|
protocol: HTTP
|
|
monitors: [{get_resource: api_monitor}]
|
|
subnet: {get_resource: fixed_subnet}
|
|
lb_method: ROUND_ROBIN
|
|
vip:
|
|
protocol_port: 8080
|
|
|
|
api_pool_floating:
|
|
type: OS::Neutron::FloatingIP
|
|
properties:
|
|
floating_network: {get_param: external_network}
|
|
port_id: {get_attr: [api_pool, vip, port_id]}
|
|
|
|
etcd_monitor:
|
|
type: OS::Neutron::HealthMonitor
|
|
properties:
|
|
type: TCP
|
|
delay: 5
|
|
max_retries: 5
|
|
timeout: 5
|
|
|
|
etcd_pool:
|
|
type: OS::Neutron::Pool
|
|
properties:
|
|
protocol: HTTP
|
|
monitors: [{get_resource: etcd_monitor}]
|
|
subnet: {get_resource: fixed_subnet}
|
|
lb_method: ROUND_ROBIN
|
|
vip:
|
|
protocol_port: 2379
|
|
|
|
######################################################################
|
|
#
|
|
# kubernetes masters. This is a resource group that will create
|
|
# <number_of_masters> masters.
|
|
#
|
|
|
|
kube_masters:
|
|
type: OS::Heat::ResourceGroup
|
|
depends_on:
|
|
- extrouter_inside
|
|
properties:
|
|
count: {get_param: number_of_masters}
|
|
resource_def:
|
|
type: kubemaster.yaml
|
|
properties:
|
|
ssh_key_name: {get_param: ssh_key_name}
|
|
server_image: {get_param: server_image}
|
|
master_flavor: {get_param: master_flavor}
|
|
external_network: {get_param: external_network}
|
|
kube_allow_priv: {get_param: kube_allow_priv}
|
|
wait_condition_timeout: {get_param: wait_condition_timeout}
|
|
flannel_network_cidr: {get_param: flannel_network_cidr}
|
|
flannel_network_subnetlen: {get_param: flannel_network_subnetlen}
|
|
flannel_use_vxlan: {get_param: flannel_use_vxlan}
|
|
portal_network_cidr: {get_param: portal_network_cidr}
|
|
discovery_url: {get_param: discovery_url}
|
|
fixed_network: {get_resource: fixed_network}
|
|
fixed_subnet: {get_resource: fixed_subnet}
|
|
api_pool_id: {get_resource: api_pool}
|
|
etcd_pool_id: {get_resource: etcd_pool}
|
|
|
|
######################################################################
|
|
#
|
|
# kubernetes minions. This is an resource group that will initially
|
|
# create <number_of_minions> minions, and needs to be manually scaled.
|
|
#
|
|
|
|
kube_minions:
|
|
type: OS::Heat::ResourceGroup
|
|
depends_on:
|
|
- extrouter_inside
|
|
- kube_masters
|
|
properties:
|
|
count: {get_param: number_of_minions}
|
|
removal_policies: [{resource_list: {get_param: minions_to_remove}}]
|
|
resource_def:
|
|
type: kubeminion.yaml
|
|
properties:
|
|
ssh_key_name: {get_param: ssh_key_name}
|
|
server_image: {get_param: server_image}
|
|
minion_flavor: {get_param: minion_flavor}
|
|
fixed_network: {get_resource: fixed_network}
|
|
fixed_subnet: {get_resource: fixed_subnet}
|
|
kube_master_ip: {get_attr: [api_pool, vip, address]}
|
|
etcd_server_ip: {get_attr: [etcd_pool, vip, address]}
|
|
external_network: {get_param: external_network}
|
|
kube_allow_priv: {get_param: kube_allow_priv}
|
|
docker_volume_size: {get_param: docker_volume_size}
|
|
wait_condition_timeout: {get_param: wait_condition_timeout}
|
|
|
|
outputs:
|
|
|
|
api_address:
|
|
value:
|
|
str_replace:
|
|
template: api_ip_address:8080
|
|
params:
|
|
api_ip_address: {get_attr: [api_pool_floating, floating_ip_address]}
|
|
description: >
|
|
This is the API endpoint of the Kubernetes server. Use this to access
|
|
the Kubernetes API from outside the cluster.
|
|
|
|
kube_masters:
|
|
value: {get_attr: [kube_masters, kube_master_external_ip]}
|
|
description: >
|
|
This is a list of "public" ip addresses of all Kubernetes master servers.
|
|
Use these addresses to log in to the Kubernetes masters via ssh.
|
|
|
|
kube_minions:
|
|
value: {get_attr: [kube_minions, kube_minion_ip]}
|
|
description: >
|
|
This is a list of the "private" addresses of all the Kubernetes minions.
|
|
|
|
kube_minions_external:
|
|
value: {get_attr: [kube_minions, kube_minion_external_ip]}
|
|
description: >
|
|
This is a list of the "public" addresses of all the Kubernetes minions. Use
|
|
these addresses to, e.g., log into the minions.
|