Merge pull request #300 from rawmind0/master

Updates for traefik, kafka and zookeeper packages
This commit is contained in:
Raúl Sánchez 2016-11-03 11:53:11 +01:00 committed by GitHub
commit 147ff3b67d
26 changed files with 893 additions and 27 deletions

View File

@ -0,0 +1,33 @@
# Apache Kafka (Experimental)
### Info:
This template creates, scale in and scale out a multinodes kafka broker cluster on top of k8s. The configuration is generated with confd from k8s.
Cluster size are variable after deployment, and get reconfigured.
### Usage:
Select Apache Kafka from catalog.
Enter the number of nodes, mem and refresh interval for the kafka cluster.
Change the following kafka default parameters, if you need:
- kafka_name="kafka" # kafka k8s service and rc name.
- kafka_namespace="kafka" # kafka k8s namespace
- kafka_scale=3 # kafka scale to deploy.
- kafka_mem=512 # kafka broker memory.
- kafka_log_dir="/opt/kafka/logs" # Kafka log dir.
- kafka_log_retention="168" # kafka log retention.
- kafka_num_partitions="1" # Kafka partitions number
- kafka_delete_topics="false" # kafka delete topics
- kafka_pub_ip= < true | false > # Advertise public ip to zookeeper.
- zk_link="kafka-zk/zk" # zookeeper namespace/service to connect to.
Click deploy.
Kafka can now be accessed over the Rancher network.
Note: When you scale the cluster, zero downtime is not guaranteed..yet..

View File

@ -0,0 +1,95 @@
.catalog:
name: Kafka
version: 0.10.0.1-k8s
description: |
(Experimental) Apache Kafka cluster.
minimum_rancher_version: v0.59.0
maintainer: "Raul Sanchez <rawmind@gmail.com>"
uuid: kafka-0
questions:
- variable: "kafka_name"
description: "Name of kafka rc and service."
label: "K8s rc name:"
required: true
default: "kafka"
type: "string"
- variable: "kafka_namespace"
description: "Name of kafka namespace."
label: "K8s namespace:"
required: true
default: "default"
type: "string"
- variable: "kafka_scale"
description: "Number of brokers nodes. Note: Recommended an odd number"
label: "Broker Nodes:"
required: true
default: 3
type: "int"
- variable: "kafka_mem"
description: "Amount of memory to config brokers."
label: "Broker Memory (mb):"
required: true
default: 1024
type: "string"
- variable: "kafka_log_dir"
description: "Broker volume to log data"
label: "Broker log volume:"
required: true
default: "/opt/kafka/logs"
type: "string"
- variable: "kafka_log_retention"
description: "Broker log retention in hours"
label: "Broker log retention (h):"
required: true
default: "168"
type: "int"
- variable: "kafka_num_partitions"
description: "Number of broker partitions"
label: "Broker partitions:"
required: true
default: "1"
type: "int"
- variable: "kafka_delete_topics"
label: "Kafka delete topics:"
description: |
Enable delete topics in kafka.
default: false
required: true
type: enum
options:
- false
- true
- variable: "kafka_interval"
description: "Interval to poll/apply configuration changes. 0 to disable"
label: "Broker Interval (s):"
required: true
default: 60
type: "int"
- variable: "kafka_pub_ip"
description: "Advertise local and host public ip"
label: "Broker public ip:"
default: false
required: true
type: enum
options:
- false
- true
- variable: "zk_link"
description: |
Choose the Zookeeper service to use.
It's really recommended a dedicated zookeeper service just for Kafka.
label: "Zookeeper stack/service"
default: "default/zookeeper"
required: true
type: "service"
broker:
scale: ${kafka_scale}
retain_ip: true
health_check:
port: 9092
interval: 5000
unhealthy_threshold: 3
request_line: ''
healthy_threshold: 2
response_timeout: 5000

View File

@ -0,0 +1,77 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: "${kafka_name}"
namespace: "${kafka_namespace}"
labels:
name: "${kafka_name}"
spec:
replicas: ${kafka_scale}
selector:
name: "${kafka_name}"
template:
metadata:
labels:
name: "${kafka_name}"
spec:
containers:
- name: "broker-conf"
image: "rawmind/k8s-kafka:0.10.0.0-4"
volumeMounts:
- mountPath: "/opt/tools"
name: "broker-conf"
ports:
imagePullPolicy: "IfNotPresent"
- name: "broker-volume"
image: "rawmind/alpine-volume:0.0.2-1"
env:
- name: SERVICE_UID
value: "10003"
- name: SERVICE_GID
value: "10003"
- name: SERVICE_VOLUME
value: "${kafka_log_dir}"
- name: KEEP_ALIVE
value: "1"
volumeMounts:
- mountPath: "${kafka_log_dir}"
name: "broker-data"
ports:
imagePullPolicy: "IfNotPresent"
- name: "broker-service"
image: "rawmind/alpine-kafka:0.10.0.1"
env:
- name: JVMFLAGS
value: "-Xmx${kafka_mem}m -Xms${kafka_mem}m"
- name: CONFD_INTERVAL
value: "${kafka_interval}"
- name: KAFKA_ZK_SERVICE
value: "${zk_link}"
- name: KAFKA_DELETE_TOPICS
value: "${kafka_delete_topics}"
- name: KAFKA_LOG_DIRS
value: "${kafka_log_dir}"
- name: KAFKA_LOG_RETENTION_HOURS
value: "${kafka_log_retention}"
- name: KAFKA_NUM_PARTITIONS
value: "${kafka_num_partitions}"
- name: ADVERTISE_PUB_IP
value: "${kafka_pub_ip}"
- name: POD_NAMESPACE
value: "${kafka_namespace}"
volumeMounts:
- mountPath: "${kafka_log_dir}"
name: "broker-data"
- mountPath: "/opt/tools"
name: "broker-conf"
ports:
- containerPort: 9092
name: "broker-client"
protocol: "TCP"
imagePullPolicy: "IfNotPresent"
restartPolicy: "Always"
volumes:
- name: "broker-data"
emptyDir: {}
- name: "broker-conf"
emptyDir: {}

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: "${kafka_name}"
labels:
name: "${kafka_name}"
spec:
ports:
- port: 9092
targetPort: 9092
name: "broker-client"
protocol: "TCP"
selector:
name: "${kafka_name}"
clusterIP: "None"

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Typo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 93.5 148.8" enable-background="new 0 0 93.5 148.8" xml:space="preserve">
<g>
<path d="M80.9,43l-0.1-0.1c-1.2-2.1-3.2-3.5-5.4-4.1c-2.3-0.6-4.7-0.3-6.8,0.9h0c-2.2,1.2-3.6,3.2-4.2,5.5
c-0.6,2.2-0.3,4.7,0.9,6.8l0,0.1c1.2,2.1,3.2,3.5,5.4,4.1c2.2,0.6,4.7,0.4,6.8-0.9l0.1-0.1c2.1-1.2,3.5-3.2,4.1-5.4
C82.4,47.6,82.1,45.1,80.9,43L80.9,43z M30.6,49.8L30.6,49.8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
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,9 @@
name: Apache Kafka
description: |
(Experimental) Kafka cluster
version: 0.10.0.1-k8s
category: Clustering
maintainer: "Raul Sanchez <rawmind@gmail.com>"
minimum_rancher_version: v0.59.0
license:
projectURL: https://github.com/rawmind0/alpine-kafka

View File

@ -0,0 +1,31 @@
# Apache Zookeeper (Experimental)
### Info:
This template creates, scale in and scale out a multinodes zk (zookeeper) cluster on top of k8s. The configuration is generated with confd watching k8s metadata.
Cluster size are variable after deployment, and get reconfigured if you scale.
The services generates ZKID's (saving them as pod labels) and start the zookeeper cluster.
### Usage:
Select Apache Zookeeper from catalog.
Change the following zookeeper default parameters, if you need:
- zk_name="zookeeper" # Name of the k8s rc and service.
- zk_namespace="default" # Name of the k8s namespace
- zk_scale="3" # Number of zk replicas
- zk_mem="512" # Mem to configure zk.
- zk_data_dir="/opt/zk/data" # Zk dataDir param value
- zk_init_limit="10" # zk initLimit param value
- zk_max_client_cxns="500" # zk maxClientCnxns param value
- zk_sync_limit="5" # zk syncLimit param value
- zk_tick_time="2000" # zk tickTime param value
Click deploy.
Zookeeper can now be accessed over the Rancher network.
Testing Feature: When you scale the cluster, zero downtime is expected...

View File

@ -0,0 +1,73 @@
.catalog:
name: Zookeeper
version: 3.4.8-k8s1
description: |
(Experimental) Apache Zookeeper cluster.
minimum_rancher_version: v0.59.0
maintainer: "Raul Sanchez <rawmind@gmail.com>"
uuid: zk-0
questions:
- variable: "zk_name"
description: "Name of zookeeper rc and service."
label: "K8s rc name:"
required: true
default: "zookeeper"
type: "string"
- variable: "zk_namespace"
description: "Name of zookeeper namespace."
label: "K8s namespace:"
required: true
default: "default"
type: "string"
- variable: "zk_scale"
description: "Number of zk nodes. Note: Recommended an odd number"
label: "Zk Nodes:"
required: true
default: 3
type: "int"
- variable: "zk_mem"
description: "Amount of memory to config zk."
label: "Zk Memory (mb):"
required: true
default: 512
type: "int"
- variable: "zk_init_limit"
description: "Time to allow followers to connect and sync with leader"
label: "Zk init limit (ticks):"
required: true
default: 10
type: "int"
- variable: "zk_data_dir"
description: "Directory where zookeeper store data"
label: "Zk data dir:"
required: true
default: "/opt/zk/data"
type: "string"
- variable: "zk_max_client_cxns"
description: "Max client concurrent connections"
label: "Zk max client cxns:"
required: true
default: 500
type: "int"
- variable: "zk_sync_limit"
description: "Time to allow followers to sync with leader"
label: "Zk sync limit (ticks):"
required: true
default: 5
type: "int"
- variable: "zk_tick_time"
description: "Tick time length"
label: "Zk tick time (ms):"
required: true
default: 2000
type: "int"
zk:
scale: ${zk_scale}
retain_ip: true
health_check:
port: 2181
interval: 5000
unhealthy_threshold: 3
request_line: ''
healthy_threshold: 2
response_timeout: 5000

View File

@ -0,0 +1,80 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: "${zk_name}"
namespace: "${zk_namespace}"
labels:
name: "${zk_name}"
spec:
replicas: ${zk_scale}
selector:
name: "${zk_name}"
template:
metadata:
labels:
name: "${zk_name}"
annotations:
spec:
containers:
- name: "zk-conf"
image: "rawmind/k8s-zk:3.4.8-10"
volumeMounts:
- mountPath: "/opt/tools"
name: "zk-conf"
ports:
imagePullPolicy: "IfNotPresent"
- name: "zk-volume"
image: "rawmind/alpine-volume:0.0.2-1"
env:
- name: SERVICE_UID
value: "10002"
- name: SERVICE_GID
value: "10002"
- name: SERVICE_VOLUME
value: "${kafka_log_dir}"
- name: KEEP_ALIVE
value: "1"
volumeMounts:
- mountPath: "${zk_data_dir}"
name: "zk-data"
ports:
imagePullPolicy: "IfNotPresent"
- name: "zk-service"
image: "rawmind/alpine-zk:3.4.8-16"
env:
- name: JVMFLAGS
value: "-Xmx${zk_mem}m -Xms${zk_mem}m"
- name: ZK_DATA_DIR
value: "${zk_data_dir}"
- name: ZK_INIT_LIMIT
value: "${zk_init_limit}"
- name: ZK_MAX_CLIENT_CXNS
value: "${zk_max_client_cxns}"
- name: ZK_SYNC_LIMIT
value: "${zk_sync_limit}"
- name: ZK_TICK_TIME
value: "${zk_tick_time}"
- name: POD_NAMESPACE
value: "${zk_namespace}"
volumeMounts:
- mountPath: "${zk_data_dir}"
name: "zk-data"
- mountPath: "/opt/tools"
name: "zk-conf"
ports:
- containerPort: 2181
name: "zk-client"
protocol: "TCP"
- containerPort: 2888
name: "zk-server"
protocol: "TCP"
- containerPort: 3888
name: "zk-leader"
protocol: "TCP"
imagePullPolicy: "IfNotPresent"
restartPolicy: "Always"
volumes:
- name: "zk-data"
emptyDir: {}
- name: "zk-conf"
emptyDir: {}

View File

@ -0,0 +1,23 @@
apiVersion: v1
kind: Service
metadata:
name: "${zk_name}"
namespace: "${zk_namespace}"
labels:
name: "${zk_name}"
spec:
ports:
- port: 2181
targetPort: 2181
name: "zk-client"
protocol: "TCP"
- port: 2888
targetPort: 2888
name: "zk-server"
protocol: "TCP"
- port: 3888
targetPort: 3888
name: "zk-leader"
protocol: "TCP"
selector:
name: "${zk_name}"

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -0,0 +1,7 @@
name: Apache Zookeeper
description: |
(Experimental) Zookeeper cluster
version: 3.4.8-k8s1
category: Clustering
maintainer: "Raul Sanchez <rawmind@gmail.com>"
projectURL: https://github.com/rawmind0/alpine-zk

View File

@ -14,12 +14,14 @@
Change the following kafka default parameters, if you need:
- KAFKA_LOG_DIRS="/opt/kafka/logs"
- KAFKA_LOG_RETENTION_HOURS="168"
- KAFKA_NUM_PARTITIONS="1"
- ADVERTISE_PUB_IP= < true | false >
Select zookeeper stack/service to connect to.
- kafka_scale=3 # kafka scale to deploy.
- kafka_mem=512 # kafka broker memory.
- kafka_log_dir="/opt/kafka/logs" # Kafka log dir.
- kafka_log_retention="168" # kafka log retention.
- kafka_num_partitions="1" # Kafka partitions number
- kafka_delete_topics="false" # kafka delete topics
- kafka_pub_ip= < true | false > # Advertise public ip to zookeeper.
- zk_link="kafka-zk/zk" # zookeeper stack/service to connect to.
Click deploy.

View File

@ -1,6 +1,6 @@
broker:
tty: true
image: rawmind/alpine-kafka:0.10.0.0-2
image: rawmind/alpine-kafka:0.10.0.1
volumes_from:
- broker-volume
- broker-conf
@ -8,6 +8,7 @@ broker:
- JVMFLAGS=-Xmx${kafka_mem}m -Xms${kafka_mem}m
- CONFD_INTERVAL=${kafka_interval}
- ZK_SERVICE=${zk_link}
- KAFKA_DELETE_TOPICS=${kafka_delete_topics}
- KAFKA_LOG_DIRS=${kafka_log_dir}
- KAFKA_LOG_RETENTION_HOURS=${kafka_log_retention}
- KAFKA_NUM_PARTITIONS=${kafka_num_partitions}
@ -24,7 +25,9 @@ broker-conf:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.hostname_override: container_name
io.rancher.container.start_once: true
image: rawmind/rancher-kafka:0.10.0.0
image: rawmind/rancher-kafka:0.10.0.0-3
volumes:
- /opt/tools
broker-volume:
net: none
labels:
@ -32,12 +35,10 @@ broker-volume:
io.rancher.container.hostname_override: container_name
io.rancher.container.start_once: true
environment:
- SERVICE_USER=kafka
- SERVICE_UID=10003
- SERVICE_GROUP=kafka
- SERVICE_GID=10003
- SERVICE_VOLUME=${kafka_log_dir}
volumes:
- ${kafka_log_dir}
volume_driver: local
image: rawmind/alpine-volume:0.0.1-1
image: rawmind/alpine-volume:0.0.2-1

View File

@ -1,6 +1,6 @@
.catalog:
name: Kafka
version: 0.10.0.0-rancher1
version: 0.10.0.1-rancher1
description: |
(Experimental) Apache Kafka cluster.
minimum_rancher_version: v0.59.0
@ -37,6 +37,16 @@
required: true
default: "1"
type: "int"
- variable: "kafka_delete_topics"
label: "Kafka delete topics:"
description: |
Enable delete topics in kafka.
default: false
required: true
type: enum
options:
- false
- true
- variable: "kafka_interval"
description: "Interval to poll/apply configuration changes. 0 to disable"
label: "Broker Interval (s):"
@ -44,11 +54,14 @@
default: 60
type: "int"
- variable: "kafka_pub_ip"
description: "Advertise host ip in zookeeper"
label: "Advertise host ip:"
required: false
default: false
type: "boolean"
description: "Advertise local and host public ip"
label: "Broker public ip:"
default: false
required: true
type: enum
options:
- false
- true
- variable: "zk_link"
description: |
Choose the Zookeeper service to use.

View File

@ -1,8 +1,9 @@
name: Apache Kafka
description: |
(Experimental) Kafka cluster
version: 0.10.0.0-rancher1
version: 0.10.0.1-rancher1
category: Clustering
maintainer: "Raul Sanchez <rawmind@gmail.com>"
minimum_rancher_version: v0.59.0
license:
projectURL: https://github.com/rawmind0/alpine-kafka

View File

@ -0,0 +1,55 @@
# Traefik active load balancer (Experimental)
### Info:
This template deploys traefik active load balancers on top of Rancher. The configuration is generated and updated with confd from Rancher metadata.
It would be deployed in hosts with label traefik_lb=true.
### Config:
- host_label = "traefik_lb=true" # Host label where to run traefik service.
- http_port = 8080 # Port exposed to get access to the published services.
- https_port = 8443 # Port exposed to get secured access to the published services.
- admin_port = 8000 # Port exposed to get admin access to the traefik service.
- https_enable = <false | true | only>
- false: Enable http enpoints and disable https ones.
- true: Enable http and https endpoints.
- only: Enable https endpoints and redirect http to https.
- acme_enable = false # Enable/Disable acme traefik support.
- acme_email = "test@traefik.io" # acme user email
- acme_ondemand = true # acme ondemand parameter.
- ssl_key # Paste your ssl key. *Required if you enable https
- ssl_crt # Paste your ssl crt. *Required if you enable https
- refresh_interval = 10s # Interval to refresh traefik rules.toml from rancher-metadata.
### Service configuration labels:
Traefik labels has to be added in your services, in order to get included in traefik dynamic config.
- traefik.enable = <true | false>
- true: the service will be published as *service_name.stack_name.traefik_domain*
- stack: the service will be published as *stack_name.traefik_domain*. WARNING: You could have collisions inside services within your stack
- false: the service will not be published
- traefik.domain = < domain > # Domain names to route rule. Multiple values separated by "," >
- traefik.port = < port > # Port to expose throught traefik
- traefik.acme = < true | false > # Enable/disable ACME traefik feature
### Usage:
Select Traefik from catalog.
Set the params.
Click deploy.
Services will be accessed throught hosts ip's whith $host_label:
- http://${service_name}.${stack_name}.${traefik.domain}:${http_port}
- https://${service_name}.${stack_name}.${traefik.domain}:${https_port}
or
- http://${stack_name}.${traefik.domain}:${http_port}
- https://${stack_name}.${traefik.domain}:${https_port}
Note: To access the services, you need to create A or CNAMES dns entries for every one.

View File

@ -0,0 +1,39 @@
traefik:
ports:
- ${admin_port}:8000/tcp
- ${http_port}:${http_port}/tcp
- ${https_port}:${https_port}/tcp
log_driver: ''
labels:
io.rancher.scheduler.global: 'true'
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.sidekicks: traefik-conf
io.rancher.container.hostname_override: container_name
tty: true
log_opt: {}
image: rawmind/alpine-traefik:1.0.2-6
environment:
- CONF_INTERVAL=${refresh_interval}
- TRAEFIK_HTTP_PORT=${http_port}
- TRAEFIK_HTTPS_PORT=${https_port}
- TRAEFIK_HTTPS_ENABLE=${https_enable}
- TRAEFIK_ACME_ENABLE=${acme_enable}
- TRAEFIK_ACME_EMAIL=${acme_email}
- TRAEFIK_ACME_ONDEMAND=${acme_ondemand}
volumes_from:
- traefik-conf
traefik-conf:
log_driver: ''
labels:
io.rancher.scheduler.global: 'true'
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.start_once: 'true'
tty: true
log_opt: {}
image: rawmind/rancher-traefik:0.3.4-6
net: none
volumes:
- /opt/tools

View File

@ -0,0 +1,95 @@
.catalog:
name: traefik
version: v1.0.2-rancher1
description: |
(Experimental) Traefik load balancer.
minimum_rancher_version: v0.59.0
maintainer: "Raul Sanchez <rawmind@gmail.com>"
uuid: traefik-0
questions:
- variable: "host_label"
description: "Host label where to run traefik service."
label: "Host label:"
required: true
default: "traefik_lb=true"
type: "string"
- variable: "http_port"
description: "Traefik http public port to listen."
label: "Http port:"
required: true
default: 8080
type: "int"
- variable: "https_port"
description: "Traefik https public port to listen."
label: "Https port:"
required: true
default: 8443
type: "int"
- variable: "admin_port"
description: "Traefik admin public port to listen."
label: "Admin port:"
required: true
default: 8000
type: "int"
- variable: "https_enable"
label: "Enable HTTPS:"
description: |
Enable https working mode. If you activate, you need to fill SSL key and SSL crt in order to work.
default: false
required: true
type: enum
options:
- false
- true
- only
- variable: "acme_enable"
description: "Enable acme support on traefik."
label: "Enable ACME:"
required: true
default: false
type: "boolean"
- variable: "acme_email"
description: "ACME user email."
label: "ACME email:"
required: true
default: "test@traefik.io"
type: "string"
- variable: "acme_ondemand"
description: "Enable acme ondemand."
label: "ACME ondemand:"
required: true
default: true
type: "boolean"
- variable: "ssl_key"
description: "SSL key to secure the service. *Required if you enable https"
label: "SSL key"
type: "multiline"
required: false
default: ""
- variable: "ssl_crt"
description: "SSL cert to secure the service. *Required if you enable https"
label: "SSL crt"
type: "multiline"
required: false
default: ""
- variable: "refresh_interval"
description: "Interval to poll/apply configuration changes."
label: "Refresh Interval (s):"
required: true
default: 10
type: "int"
traefik:
retain_ip: true
health_check:
port: 8000
interval: 5000
unhealthy_threshold: 3
request_line: 'GET /dashboard/# HTTP/1.0'
healthy_threshold: 2
response_timeout: 5000
metadata:
traefik:
ssl_key: |
${ssl_key}
ssl_crt: |
${ssl_crt}

View File

@ -0,0 +1,55 @@
# Traefik active load balancer (Experimental)
### Info:
This template deploys traefik active load balancers on top of Rancher. The configuration is generated and updated with confd from Rancher metadata.
It would be deployed in hosts with label traefik_lb=true.
### Config:
- host_label = "traefik_lb=true" # Host label where to run traefik service.
- http_port = 8080 # Port exposed to get access to the published services.
- https_port = 8443 # Port exposed to get secured access to the published services.
- admin_port = 8000 # Port exposed to get admin access to the traefik service.
- https_enable = <false | true | only>
- false: Enable http enpoints and disable https ones.
- true: Enable http and https endpoints.
- only: Enable https endpoints and redirect http to https.
- acme_enable = false # Enable/Disable acme traefik support.
- acme_email = "test@traefik.io" # acme user email
- acme_ondemand = true # acme ondemand parameter.
- ssl_key # Paste your ssl key. *Required if you enable https
- ssl_crt # Paste your ssl crt. *Required if you enable https
- refresh_interval = 10s # Interval to refresh traefik rules.toml from rancher-metadata.
### Service configuration labels:
Traefik labels has to be added in your services, in order to get included in traefik dynamic config.
- traefik.enable = <true | false>
- true: the service will be published as *service_name.stack_name.traefik_domain*
- stack: the service will be published as *stack_name.traefik_domain*. WARNING: You could have collisions inside services within your stack
- false: the service will not be published
- traefik.domain = < domain > # Domain names to route rule. Multiple values separated by "," >
- traefik.port = < port > # Port to expose throught traefik
- traefik.acme = < true | false > # Enable/disable ACME traefik feature
### Usage:
Select Traefik from catalog.
Set the params.
Click deploy.
Services will be accessed throught hosts ip's whith $host_label:
- http://${service_name}.${stack_name}.${traefik.domain}:${http_port}
- https://${service_name}.${stack_name}.${traefik.domain}:${https_port}
or
- http://${stack_name}.${traefik.domain}:${http_port}
- https://${stack_name}.${traefik.domain}:${https_port}
Note: To access the services, you need to create A or CNAMES dns entries for every one.

View File

@ -0,0 +1,38 @@
traefik:
ports:
- ${admin_port}:8000/tcp
- ${http_port}:${http_port}/tcp
- ${https_port}:${https_port}/tcp
log_driver: ''
labels:
io.rancher.scheduler.global: 'true'
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.sidekicks: traefik-conf
io.rancher.container.hostname_override: container_name
tty: true
log_opt: {}
image: rawmind/alpine-traefik:1.0.3
environment:
- CONF_INTERVAL=${refresh_interval}
- TRAEFIK_HTTP_PORT=${http_port}
- TRAEFIK_HTTPS_PORT=${https_port}
- TRAEFIK_HTTPS_ENABLE=${https_enable}
- TRAEFIK_ACME_ENABLE=${acme_enable}
- TRAEFIK_ACME_EMAIL=${acme_email}
- TRAEFIK_ACME_ONDEMAND=${acme_ondemand}
volumes_from:
- traefik-conf
traefik-conf:
log_driver: ''
labels:
io.rancher.scheduler.global: 'true'
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.start_once: 'true'
tty: true
log_opt: {}
image: rawmind/rancher-traefik:0.3.4-6
net: none
volumes:
- /opt/tools

View File

@ -0,0 +1,95 @@
.catalog:
name: traefik
version: v1.0.3-rancher1
description: |
(Experimental) Traefik load balancer.
minimum_rancher_version: v0.59.0
maintainer: "Raul Sanchez <rawmind@gmail.com>"
uuid: traefik-0
questions:
- variable: "host_label"
description: "Host label where to run traefik service."
label: "Host label:"
required: true
default: "traefik_lb=true"
type: "string"
- variable: "http_port"
description: "Traefik http public port to listen."
label: "Http port:"
required: true
default: 8080
type: "int"
- variable: "https_port"
description: "Traefik https public port to listen."
label: "Https port:"
required: true
default: 8443
type: "int"
- variable: "admin_port"
description: "Traefik admin public port to listen."
label: "Admin port:"
required: true
default: 8000
type: "int"
- variable: "https_enable"
label: "Enable HTTPS:"
description: |
Enable https working mode. If you activate, you need to fill SSL key and SSL crt in order to work.
default: false
required: true
type: enum
options:
- false
- true
- only
- variable: "acme_enable"
description: "Enable acme support on traefik."
label: "Enable ACME:"
required: true
default: false
type: "boolean"
- variable: "acme_email"
description: "ACME user email."
label: "ACME email:"
required: true
default: "test@traefik.io"
type: "string"
- variable: "acme_ondemand"
description: "Enable acme ondemand."
label: "ACME ondemand:"
required: true
default: true
type: "boolean"
- variable: "ssl_key"
description: "SSL key to secure the service. *Required if you enable https"
label: "SSL key"
type: "multiline"
required: false
default: ""
- variable: "ssl_crt"
description: "SSL cert to secure the service. *Required if you enable https"
label: "SSL crt"
type: "multiline"
required: false
default: ""
- variable: "refresh_interval"
description: "Interval to poll/apply configuration changes."
label: "Refresh Interval (s):"
required: true
default: 10
type: "int"
traefik:
retain_ip: true
health_check:
port: 8000
interval: 5000
unhealthy_threshold: 3
request_line: 'GET /dashboard/# HTTP/1.0'
healthy_threshold: 2
response_timeout: 5000
metadata:
traefik:
ssl_key: |
${ssl_key}
ssl_crt: |
${ssl_crt}

View File

@ -1,8 +1,9 @@
name: Traefik
description: |
(Experimental) Traefik active load balancer
version: v1.0.1-rancher1
version: v1.0.3-rancher1
category: Load Balancing
maintainer: "Raul Sanchez <rawmind@gmail.com>"
minimum_rancher_version: v0.59.0
license:
projectURL: https://github.com/rawmind0/alpine-traefik

View File

@ -24,4 +24,4 @@
Zookeeper can now be accessed over the Rancher network.
Note: When you scale the cluster, zero downtime is not guaranteed..yet..
Note: When you scale the cluster, zero downtime is expected...

View File

@ -1,6 +1,6 @@
zk:
tty: true
image: rawmind/alpine-zk:3.4.8-4
image: rawmind/alpine-zk:3.4.8-16
volumes_from:
- zk-volume
- zk-conf
@ -21,7 +21,9 @@ zk-conf:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.hostname_override: container_name
io.rancher.container.start_once: true
image: rawmind/rancher-zk:0.3.3
image: rawmind/rancher-zk:3.4.8-5
volumes:
- /opt/tools
zk-volume:
net: none
labels:
@ -29,12 +31,10 @@ zk-volume:
io.rancher.container.hostname_override: container_name
io.rancher.container.start_once: true
environment:
- SERVICE_USER=zookeeper
- SERVICE_UID=10002
- SERVICE_GROUP=zookeeper
- SERVICE_GID=10002
- SERVICE_VOLUME=${zk_data_dir}
volumes:
- ${zk_data_dir}
volume_driver: local
image: rawmind/alpine-volume:0.0.1-1
image: rawmind/alpine-volume:0.0.2-1

View File

@ -4,5 +4,5 @@ description: |
version: 3.4.8-rancher1
category: Clustering
maintainer: "Raul Sanchez <rawmind@gmail.com>"
minimum_rancher_version: v0.59.0
license:
projectURL: https://github.com/rawmind0/alpine-zk
license: