Traefik

Traefik2.2.0 安装部署详解

邮差的信 提交于 2020-05-01 09:16:25
转载地址 转载原站地址 前提: Traefik 2.X.0 现已发布一段时间,版本更新不少新特性,尤其是TCP转发和http转发并存这个亮点,可以解决不少业务问题,节省很多核心网络端口,特裸机部署进行体验。 核心概念 Traefik 类似边缘路由器,可以作为整个平台的入口,根据逻辑和规则,处理并路由每个传入的请求。这些规则确定哪些服务处理哪些请求;传统的反向代理需要一个配置文件,其中包含路由到你服务的所有可能路由,而Traefik 会实时检测服务并自动更新路由规则,可以自动服务发现。 Entrypoint 这是流量的入口,它们定义了接收请求的端口(HTTP或者TCP)。 Providers 用来自动发现平台上的服务,可以是编排工具、容器引擎或者 key-value 存储等,比如 Docker、Kubernetes、File Routers 分析请求(host, path, headers, SSL, …),负责将传入请求连接到可以处理这些请求的服务上去。 Services 将请求转发给你的应用(load balancing, …),负责配置如何获取最终将处理传入请求的实际服务。 Middlewares 中间件,用来修改请求或者根据请求来做出一些判断(authentication, rate limiting, headers, ...),中间件被附件到路由上

解决项目迁移至Kubernetes集群中的代理问题

前提是你 提交于 2020-04-23 22:29:47
解决项目迁移至Kubernetes集群中的代理问题 随着Kubernetes技术的日益成熟,越来越多的企业选择用Kubernetes集群来管理项目。新项目还好,可以选择合适的集群规模从零开始构建项目;旧项目迁移进Kubernetes集群就需要考虑很多因素,毕竟项目不能中断时间过久。 问题来源 近日在做项目迁移至Kubernetes集群时,遇到了一件有意思的问题:因为开发用的dubbo版本过低,在zookeeper注册不上,需要开发升级dobbo,然后在打包成镜像,所以要先把nodejs迁移进Kubernets集群。因为是部分业务迁移进Kubernets集群,所以要在traefik 前面还得加一层代理Nginx(Nginx为旧业务的入口,反向代理后面的微服务,阿里云的slb指向nginx,等到业务全部迁移完毕,slb就指向traefik)。此种架构为双层代理,即Slb-->Nginx-->Traefik-->Service 。 图解 解决方案: 迁移至k8s集群的业务走Nodeport,Nginx --> Nodeport。业务应用直接Nodeport,不好管理,1万台机器的时候 不能也Nodeport吧,端口自己要规划,机器多了 每个机器还都暴露端口,想想都不现实 迁移至k8s集群的业务走Clusterip,Nginx --> Traefik --> Service。这种方式合理。

Problem using traefik as load balancer in Kubernetes

六月ゝ 毕业季﹏ 提交于 2020-04-18 03:57:10
问题 The situation is that I have two k8s services which are connected between them. Both are flask servers. The connection between them is as follows, if someone makes a POST to the first one, this get the text input and POST it to the second server which adds some more text to the original text that was posted by the user and, finally, the two texts together are returned to the first server and it returns the final text to the user. To allow this connection between my k8s services (called master

Traefik returns “”backend not found" error

99封情书 提交于 2020-03-28 06:40:12
问题 I have the following Docker compose file: version: "3.7" services: shinyproxy: build: /home/shinyproxy deploy: replicas: 3 user: root:root hostname: shinyproxy image: shinyproxy-example labels: - traefik.enable=true - traefik.backend.loadbalancer.swarm=true - traefik.backend=shinyproxy - traefik.frontend.rule=Host:analytics.data-mastery.com; - traefik.port=5000 - traefik.docker.network=sp-example-net keycloak: image: jboss/keycloak labels: - traefik.enable=true - traefik.backend.loadbalancer

Should I use NodePort in my Traefik deployment on Kubernetes?

寵の児 提交于 2020-03-19 06:18:29
问题 According to Traefik's Kubernetes guide, I should use a Service of type NodePort to expose Traefik (YAML file here). However, if I do that, how do I expose one of the IPs from my cluster to the outside world? At this moment, I have edited the example traefik-deployment.yaml file to be a LoadBalancer instead, and it seems to work just fine with the IP that the load balancer provides. What am I missing? 回答1: Both are valid approaches. The Kubernetes guide basically makes one proposal to set

request forwarding on specific port with traefik(v2) router

情到浓时终转凉″ 提交于 2020-01-23 13:05:58
问题 The bounty expires in 4 days . Answers to this question are eligible for a +50 reputation bounty. Dhaval Goti is looking for an answer from a reputable source . I am using traefik version 2(or 2.x) and I want to forward all the request from port 80 to different port like 8081 with traefik router. So request like http://localhost/xx will be forwarded to http://localhost:8081/xx URL. I am newbie with traefik and I am using docker for this configuration. Below is my docker-compose.yml file

Use existing LetsEncrypt certificates in Traefik

强颜欢笑 提交于 2020-01-15 10:22:32
问题 Is it possible to use existing LetsEncrypt certificates (.pem format) in Traefik? I have Traefik/Docker set up to generate acme.json - can I import my existing certificates for a set of domains? 回答1: Eventually I found the correct solution - not to use Traefik's ACME integration but instead to simply mount a network volume (EFS) containing certificates as issued by certbot in manual mode. Why was this my chosen method? Because I'm mounting that certificate-holding NFS volume on two servers

Use existing LetsEncrypt certificates in Traefik

谁说胖子不能爱 提交于 2020-01-15 10:21:14
问题 Is it possible to use existing LetsEncrypt certificates (.pem format) in Traefik? I have Traefik/Docker set up to generate acme.json - can I import my existing certificates for a set of domains? 回答1: Eventually I found the correct solution - not to use Traefik's ACME integration but instead to simply mount a network volume (EFS) containing certificates as issued by certbot in manual mode. Why was this my chosen method? Because I'm mounting that certificate-holding NFS volume on two servers

Traefik and Let's Encrypt on non default http port 80?

隐身守侯 提交于 2020-01-06 08:01:17
问题 I tried setting up test container to work with traefik and lets encrypt. Traefik is not running on default ports 80 and 443. The server already has apache, reverse proxy ngnix and tomcat locally installed so ports: 80, 443 and 8080 are not available. As far as I can understand the log, there is a misconfiguration concerning the ACME ports. The test container seems to get correctly wired to the entrypoint. How do I get lets encrypt and traefik to work in this scenario or did I do something

Traefik: HTTPS access between applications does not work

主宰稳场 提交于 2020-01-05 07:03:13
问题 in our setup we use the latest traefik as reverse-proxy which has routes to a demo confluence and a keycloak server. traefik | | confluence keycloak Each application has it's own docker-compose file and is started separately. Traefik defines a virtual network, confluence and keycloak are also in this network. With the correct DNS settings it is possible for a user to access traefik, confluence and keycloak. It works as expected. To use the keycloak web SSO system it is necessary the