haproxy - HAProxy 动态 Kubernetes 前端模式匹配
问题描述
HAProxy 中是否可以匹配通过数据平面 consul 集成动态创建的后端?
在这种情况下,我想动态匹配
frontend hap
mode http
bind 127.0.0.1:80
bind 1.1.1.1:80
# URL Pattern should be K8S_Namespace/K8S_Service
acl PATH_srvc path_beg -i /dev/another-nginx-service-nodeport
# What is desired is to use the backend with wildcards for namespace and service
# use backend *-K8S_Service-K8S_Namespace
use_backend consul-backend-1.1.1.1-80-another-nginx-service-nodeport-dev if PATH_srvc
backend consul-backend-1.1.1.1-80-another-nginx-service-nodeport-dev
我想做的只是基于命名空间进行匹配,在这种情况下命名空间:dev 和服务名称:another-nginx-service-nodeport。
服务的 consul-backend-ip-port 部分不感兴趣。我是 HAProxy 的新手,但我无法在文档中找到类似的东西......我找到了一些提示,但在这种情况下它需要使用地图,而我没有......
use_backend be_%[path,map_beg(/etc/hapee-1.8/paths.map)]
这可能是一个远景我的目标是使用 HAProxy 作为代理到 K8S 集群上的一系列后端,利用 Consul HAProxy 集成。
解决方案
推荐阅读
- algorithm - 请解释这个模指数的代码
- java - 休眠中的 OutOfMemoryError 异常
- sql - Sql 删除子查询中的空值
- apache-spark - 关于 Spark sql 表和数据库的问题
- github - Github 对有效的现有工作说“等待状态报告”
- javascript - 简单的对象数组排序无法正常工作
- c# - 想要在 asp.net 中应用 javascript 函数时出错
- geoserver - Postgis 数据库中的 DTED 数据使用 geoserver 和 WCS 提供服务
- java - 名为“java.nio.channels.OverlappingFileLockException”的错误
- c# - EntityFrameworkCore 添加或更新