- 浏览: 2551197 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Traefik 2020(1)Introduction and Installation
Support ACME(Let’s Encrypt), Support WebSocket and HTTP/2
Providers - Docker, Kubernetes, File
Entrypoints -
Routers - host, path, headers, SSL
Services
Middlewares - authentication, rate limiting, headers
Different release is here https://github.com/containous/traefik/releases
Try this quick starter
https://www.katacoda.com/courses/traefik/deploy-load-balancer
Check version
>docker-compose --version
docker-compose version 1.21.2, build a133471
Another quick starter here
https://docs.traefik.cn/#quickstart
Current release is https://github.com/containous/traefik/releases/tag/v2.1.6
> wget https://github.com/containous/traefik/releases/download/v2.1.6/traefik_v2.1.6_linux_amd64.tar.gz
> tar zxvf traefik_v2.1.6_linux_amd64.tar.gz
> mkdir traefik-2.1.6
> mv traefik traefik-2.1.6/
> mv traefik-2.1.6 ~/tool/
> sudo ln -s /home/carl/tool/traefik-2.1.6 /opt/traefik-2.1.6
> sudo ln -s /opt/traefik-2.1.6 /opt/traefik
Check version
> ./traefik version
Version: 2.1.6
Codename: cantal
Go version: go1.13.8
Built: 2020-02-28T17:40:18Z
OS/Arch: linux/amd64
Sample configuration
https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml
> wget https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml
> cp traefik.sample.toml traefik.toml
Just the default content
> cat traefik.toml
################################################################
#
# Configuration sample for Traefik v2.
#
# For Traefik v1: https://github.com/containous/traefik/blob/v1.7/traefik.sample.toml
#
################################################################
################################################################
# Global configuration
################################################################
[global]
checkNewVersion = true
sendAnonymousUsage = true
################################################################
# Entrypoints configuration
################################################################
# Entrypoints definition
#
# Optional
# Default:
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.websecure]
address = ":443"
################################################################
# Traefik logs configuration
################################################################
# Traefik logs
# Enabled by default and log to stdout
#
# Optional
#
[log]
# Log level
#
# Optional
# Default: "ERROR"
#
# level = "DEBUG"
# Sets the filepath for the traefik log. If not specified, stdout will be used.
# Intermediate directories are created if necessary.
#
# Optional
# Default: os.Stdout
#
# filePath = "log/traefik.log"
# Format is either "json" or "common".
#
# Optional
# Default: "common"
#
# format = "json"
################################################################
# Access logs configuration
################################################################
# Enable access logs
# By default it will write to stdout and produce logs in the textual
# Common Log Format (CLF), extended with additional fields.
#
# Optional
#
# [accessLog]
# Sets the file path for the access log. If not specified, stdout will be used.
# Intermediate directories are created if necessary.
#
# Optional
# Default: os.Stdout
#
# filePath = "/path/to/log/log.txt"
# Format is either "json" or "common".
#
# Optional
# Default: "common"
#
# format = "json"
################################################################
# API and dashboard configuration
################################################################
# Enable API and dashboard
[api]
# Enable the API in insecure mode
#
# Optional
# Default: true
#
# insecure = false
# Enabled Dashboard
#
# Optional
# Default: true
#
# dashboard = false
################################################################
# Ping configuration
################################################################
# Enable ping
[ping]
# Name of the related entry point
#
# Optional
# Default: "traefik"
#
# entryPoint = "traefik"
################################################################
# Docker configuration backend
################################################################
# Enable Docker configuration backend
[providers.docker]
# Docker server endpoint. Can be a tcp or a unix socket endpoint.
#
# Required
# Default: "unix:///var/run/docker.sock"
#
# endpoint = "tcp://10.10.10.10:2375"
# Default host rule.
#
# Optional
# Default: "Host(`{{ normalize .Name }}`)"
#
# defaultRule = "Host(`{{ normalize .Name }}.docker.localhost`)"
# Expose containers by default in traefik
#
# Optional
# Default: true
#
# exposedByDefault = false
Start the command
> ./traefik -c traefik.toml
Need the sudo to use port 80
> sudo ./traefik -c traefik.toml
Visit the page http://rancher-home:8080/, not working as plan.
Try the Docker small image way
> docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.toml traefik
Feel the documents are too old.
Need to try this one
https://docs.traefik.io/getting-started/quick-start/
Prepare the docker-compose.yml file
> cat docker-compose.yml
version: '3'
services:
reverse-proxy:
image: traefik:v2.2
command: --api.insecure=true --providers.docker
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Start the proxy
> docker-compose up -d reverse-proxy
Check running
> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
01941cec6a8b traefik:v2.2 "/entrypoint.sh --ap…" 30 seconds ago Up 28 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:8080->8080/tcp traefik_reverse-proxy_1
Rawdata from API
http://localhost:8080/api/rawdata
Visit the UI
http://localhost:8080/#/
Add one container to the compose file
> cat docker-compose.yml
version: '3'
services:
reverse-proxy:
image: traefik:v2.2
command: --api.insecure=true --providers.docker
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
whoami:
image: containous/whoami
labels:
- "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"
Start the new API
> docker-compose up -d whoami
Verify that
> curl -H Host:whoami.docker.localhost http://127.0.0.1
Hostname: 6f10bb7464ba
IP: 127.0.0.1
IP: 172.18.0.3
RemoteAddr: 172.18.0.2:36600
GET / HTTP/1.1
Host: whoami.docker.localhost
User-Agent: curl/7.61.1
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 172.18.0.1
X-Forwarded-Host: whoami.docker.localhost
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: 01941cec6a8b
X-Real-Ip: 172.18.0.1
Add to the hosts
> cat /etc/hosts
127.0.0.1 whoami.docker.localhost
Visit this URL
http://whoami.docker.localhost/
Scala up more instances
> docker-compose up -d --scale whoami=2
References:
https://docs.traefik.io/getting-started/install-traefik/
https://www.jianshu.com/p/32aed362ac6c
https://docs.traefik.cn/
https://www.katacoda.com/courses/traefik/deploy-load-balancer
https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml
https://docs.traefik.io/getting-started/configuration-overview/
Support ACME(Let’s Encrypt), Support WebSocket and HTTP/2
Providers - Docker, Kubernetes, File
Entrypoints -
Routers - host, path, headers, SSL
Services
Middlewares - authentication, rate limiting, headers
Different release is here https://github.com/containous/traefik/releases
Try this quick starter
https://www.katacoda.com/courses/traefik/deploy-load-balancer
Check version
>docker-compose --version
docker-compose version 1.21.2, build a133471
Another quick starter here
https://docs.traefik.cn/#quickstart
Current release is https://github.com/containous/traefik/releases/tag/v2.1.6
> wget https://github.com/containous/traefik/releases/download/v2.1.6/traefik_v2.1.6_linux_amd64.tar.gz
> tar zxvf traefik_v2.1.6_linux_amd64.tar.gz
> mkdir traefik-2.1.6
> mv traefik traefik-2.1.6/
> mv traefik-2.1.6 ~/tool/
> sudo ln -s /home/carl/tool/traefik-2.1.6 /opt/traefik-2.1.6
> sudo ln -s /opt/traefik-2.1.6 /opt/traefik
Check version
> ./traefik version
Version: 2.1.6
Codename: cantal
Go version: go1.13.8
Built: 2020-02-28T17:40:18Z
OS/Arch: linux/amd64
Sample configuration
https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml
> wget https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml
> cp traefik.sample.toml traefik.toml
Just the default content
> cat traefik.toml
################################################################
#
# Configuration sample for Traefik v2.
#
# For Traefik v1: https://github.com/containous/traefik/blob/v1.7/traefik.sample.toml
#
################################################################
################################################################
# Global configuration
################################################################
[global]
checkNewVersion = true
sendAnonymousUsage = true
################################################################
# Entrypoints configuration
################################################################
# Entrypoints definition
#
# Optional
# Default:
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.websecure]
address = ":443"
################################################################
# Traefik logs configuration
################################################################
# Traefik logs
# Enabled by default and log to stdout
#
# Optional
#
[log]
# Log level
#
# Optional
# Default: "ERROR"
#
# level = "DEBUG"
# Sets the filepath for the traefik log. If not specified, stdout will be used.
# Intermediate directories are created if necessary.
#
# Optional
# Default: os.Stdout
#
# filePath = "log/traefik.log"
# Format is either "json" or "common".
#
# Optional
# Default: "common"
#
# format = "json"
################################################################
# Access logs configuration
################################################################
# Enable access logs
# By default it will write to stdout and produce logs in the textual
# Common Log Format (CLF), extended with additional fields.
#
# Optional
#
# [accessLog]
# Sets the file path for the access log. If not specified, stdout will be used.
# Intermediate directories are created if necessary.
#
# Optional
# Default: os.Stdout
#
# filePath = "/path/to/log/log.txt"
# Format is either "json" or "common".
#
# Optional
# Default: "common"
#
# format = "json"
################################################################
# API and dashboard configuration
################################################################
# Enable API and dashboard
[api]
# Enable the API in insecure mode
#
# Optional
# Default: true
#
# insecure = false
# Enabled Dashboard
#
# Optional
# Default: true
#
# dashboard = false
################################################################
# Ping configuration
################################################################
# Enable ping
[ping]
# Name of the related entry point
#
# Optional
# Default: "traefik"
#
# entryPoint = "traefik"
################################################################
# Docker configuration backend
################################################################
# Enable Docker configuration backend
[providers.docker]
# Docker server endpoint. Can be a tcp or a unix socket endpoint.
#
# Required
# Default: "unix:///var/run/docker.sock"
#
# endpoint = "tcp://10.10.10.10:2375"
# Default host rule.
#
# Optional
# Default: "Host(`{{ normalize .Name }}`)"
#
# defaultRule = "Host(`{{ normalize .Name }}.docker.localhost`)"
# Expose containers by default in traefik
#
# Optional
# Default: true
#
# exposedByDefault = false
Start the command
> ./traefik -c traefik.toml
Need the sudo to use port 80
> sudo ./traefik -c traefik.toml
Visit the page http://rancher-home:8080/, not working as plan.
Try the Docker small image way
> docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.toml traefik
Feel the documents are too old.
Need to try this one
https://docs.traefik.io/getting-started/quick-start/
Prepare the docker-compose.yml file
> cat docker-compose.yml
version: '3'
services:
reverse-proxy:
image: traefik:v2.2
command: --api.insecure=true --providers.docker
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Start the proxy
> docker-compose up -d reverse-proxy
Check running
> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
01941cec6a8b traefik:v2.2 "/entrypoint.sh --ap…" 30 seconds ago Up 28 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:8080->8080/tcp traefik_reverse-proxy_1
Rawdata from API
http://localhost:8080/api/rawdata
Visit the UI
http://localhost:8080/#/
Add one container to the compose file
> cat docker-compose.yml
version: '3'
services:
reverse-proxy:
image: traefik:v2.2
command: --api.insecure=true --providers.docker
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
whoami:
image: containous/whoami
labels:
- "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"
Start the new API
> docker-compose up -d whoami
Verify that
> curl -H Host:whoami.docker.localhost http://127.0.0.1
Hostname: 6f10bb7464ba
IP: 127.0.0.1
IP: 172.18.0.3
RemoteAddr: 172.18.0.2:36600
GET / HTTP/1.1
Host: whoami.docker.localhost
User-Agent: curl/7.61.1
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 172.18.0.1
X-Forwarded-Host: whoami.docker.localhost
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: 01941cec6a8b
X-Real-Ip: 172.18.0.1
Add to the hosts
> cat /etc/hosts
127.0.0.1 whoami.docker.localhost
Visit this URL
http://whoami.docker.localhost/
Scala up more instances
> docker-compose up -d --scale whoami=2
References:
https://docs.traefik.io/getting-started/install-traefik/
https://www.jianshu.com/p/32aed362ac6c
https://docs.traefik.cn/
https://www.katacoda.com/courses/traefik/deploy-load-balancer
https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml
https://docs.traefik.io/getting-started/configuration-overview/
发表评论
-
Stop Update Here
2020-04-28 09:00 315I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 475NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 367Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 368Docker Swarm 2020(1)Simply Inst ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 430Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 435Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 373Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 454VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 384Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 475NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 421Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 337Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 246GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 450GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 326GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 312Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 317Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 292Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 311Serverless with NodeJS and Tenc ... -
Nginx Deal with OPTIONS in HTTP Protocol
2020-02-15 01:33 356Nginx Deal with OPTIONS in HTTP ...
相关推荐
Untangle Introduction & Installation
ISO/IEC DIS 15408-1:2020 Introduction and general model.pdf
Hack Audio:An Introduction to Computer Programming and DSP in Matlab.part1.rar (15 MB, 下载次数: 237 ) Hack Audio:An Introduction to Computer Programming and DSP in Matlab.part2.rar (15 MB, 下载...
Simultaneous Localization and Mapping for Mobile Robots: Introduction and Methods Simultaneous Localization and Mapping for Mobile Robots: Introduction and Methods
《Introduction to Probability and Statistics for Engineers and Scientists》是一本由UC Berkeley著名教授Sheldon M. Ross编写的教材,该书主要面向工程学和科学领域的学生及从业者。本书英文版为读者提供了深入...
1. **极限与连续性**:首先,读者会接触到极限的概念,这是理解微积分基础的起点。极限用于描述函数在接近某一值时的行为,以及定义函数的连续性。连续函数在数学分析中占有重要地位,因为它们保证了微分和积分的...
Introduction to Java Programming and Data Structures, Comprehensive Version, Global Edition,11ed,梁勇教授(Y.Daniel Liang)最新的教材,第11版,全网独家资源。原版高清pdf,可以打印,非扫描版,内含全部...
MIT的Introduction to Computer Science and Programming Using Python 计算机科学及python编程导论课程的的教材,最新版本,是2013年8月份的,绿色封皮那个
3 edition (October 30, 2004) <br>Applying UML and Patterns is the world\'s #1 business and college introduction to \"thinking in objects\"and using that insight in real-world object-oriented ...
Karl J. Åström, Richard M. Murray - Feedback Systems_ An Introduction for Scientists and Engineers (2008) 反馈系统,控制论学习
Introduction to Python Programming and developing GUI applications with PyQT.pdf 作者B.M. Harwani © 2012 Course Technology, a part of Cengage Learning. ISBN-13: 978-1-4354-6097-3 ISBN-10: 1-4354-6097...
This book explains and helps readers to develop geometric intuition as it relates to differential forms. It includes over 250 figures to aid understanding and enable readers to visualize the concepts ...
The solutions of Introduction to VLSI Circuits and Systems
Introduction to Lie algebras and representation theory (Springer,Third printing, revised, 1980)(T)(186s) - James E. Humphreys.djvu
book, we provide sample syllabi to identify the Knowledge Areas and Knowledge Units. The sample syllabi are for a three semester course sequence and serve as an example for institutional customization...
Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition
1. **Installation:** - Install Python if it is not already installed. - Install PyQt4 using pip or another package manager. - Verify the installation by running a simple PyQt4 script. 2. **...
Introduction to Computing and Programming in Python(4th) 英文无水印pdf 第4版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源...
《Introduction to Robotics Mechanics and Control》是由著名机器人学专家John J. Craig编写的经典教材,现在已经更新到了第三版。这本书深入浅出地介绍了机器人学的基础知识,是为本科生和研究生设计的入门读物,...