feat(kubernetes): Traefik load balancer
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# Traefik load balancer
|
||||
|
||||
### Info:
|
||||
|
||||
This template deploys traefik active load balancer on top of Rancher. It would be deployed in hosts with label **traefik_lb=true**.
|
||||
|
||||
### Config:
|
||||
|
||||
- Replicas: Number of pods to deploy. It should be the same of hosts whith traefik_lb=true
|
||||
- Kubernetes Namespace = Kubernetes namespace to deploy de repservers lication controller
|
||||
- Http port = 80 # Port exposed to get access to the published services.
|
||||
- Https port = 443 # Port exposed to get access to the published services.
|
||||
- Admin port = 8000 # Port exposed to get admin access to the traefik service.
|
||||
|
||||
|
||||
### Service configuration:
|
||||
|
||||
You have to create Ingress objects in order to get included in traefik dynamic config. Example:
|
||||
|
||||
```
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: foo
|
||||
namespace: default
|
||||
spec:
|
||||
rules:
|
||||
- host: foo.bar.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: foo
|
||||
servicePort: 8080
|
||||
```
|
||||
|
||||
### Usage:
|
||||
|
||||
- Select Traefik from catalog.
|
||||
- Review configuration options.
|
||||
- Click deploy.
|
||||
- Services with Ingress will be accessed throught hosts whith traefik_lb=true
|
||||
@@ -0,0 +1,38 @@
|
||||
.catalog:
|
||||
name: traefik
|
||||
version: v1.0.2
|
||||
description: |
|
||||
Traefik load balancer.
|
||||
minimum_rancher_version: v0.59.0
|
||||
maintainer: "German Ramos <german.ramos@gmail.com>"
|
||||
uuid: traefik-0
|
||||
questions:
|
||||
- variable: NAMESPACE
|
||||
default: default
|
||||
label: Kubernetes Namespace
|
||||
required: true
|
||||
type: string
|
||||
- variable: REPLICAS
|
||||
description: Usually match the number of nodes with label traefik_lb=true
|
||||
default: 1
|
||||
label: Replicas
|
||||
required: true
|
||||
type: int
|
||||
- variable: "http_port"
|
||||
description: "Traefik http public port to listen."
|
||||
label: "Http port:"
|
||||
required: true
|
||||
default: 80
|
||||
type: "int"
|
||||
- variable: "https_port"
|
||||
description: "Traefik https public port to listen."
|
||||
label: "Http port:"
|
||||
required: true
|
||||
default: 443
|
||||
type: "int"
|
||||
- variable: "admin_port"
|
||||
description: "Traefik admin public port to listen."
|
||||
label: "Admin port:"
|
||||
required: true
|
||||
default: 8000
|
||||
type: "int"
|
||||
@@ -0,0 +1,34 @@
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
namespace: ${NAMESPACE}
|
||||
name: traefik-ingress-controller
|
||||
labels:
|
||||
k8s-app: traefik-ingress
|
||||
spec:
|
||||
replicas: ${REPLICAS}
|
||||
selector:
|
||||
k8s-app: traefik-ingress
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: traefik-ingress
|
||||
name: traefik-ingress
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
containers:
|
||||
- image: traefik:v1.0.2
|
||||
name: traefik-ingress
|
||||
ports:
|
||||
- containerPort: 80
|
||||
hostPort: ${http_port}
|
||||
- containerPort: 443
|
||||
hostPort: ${https_port}
|
||||
- containerPort: 8080
|
||||
hostPort: ${admin_port}
|
||||
args:
|
||||
- --web
|
||||
- --kubernetes
|
||||
#- --logLevel=DEBUG
|
||||
nodeSelector:
|
||||
traefik_lb: "true"
|
||||
Reference in New Issue
Block a user