简体   繁体   English

Kubernetes:将mod_cluster替换为后端服务(反向代理)

[英]Kubernetes: Replace mod_cluster for back end services (reverse proxy)

I am migrating my current service to Kubernetes. 我正在将当前的服务迁移到Kubernetes。 Currently back end services are resolved via mod_cluster. 当前,后端服务是通过mod_cluster解决的。 mod cluster manager runs on httpd and mod_cluster clients auto register their web contexts with httpd/mod_cluster manager on startup mod集群管理器在httpd上运行,并且mod_cluster客户端在启动时自动向httpd / mod_cluster管理器注册其Web上下文

user-->ingress-rule--> httpd [running mod_cluster manager]--> Jboss[mod_cluster clients]

I resolve my UI via the following ingress rule 我通过以下入口规则解析我的UI

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: httpd
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
spec:
  rules:
  - host: myk8s.myath.myserv.com
    http:
      paths:
      - path: /
        backend:
          serviceName: httpd
          servicePort: 443
  tls:
  - hosts:
    - myk8s.myath.myserv.com

This works well, resolves UI, can log in and resolve all static content etc. 这可以很好地工作,解析UI,可以登录并解析所有静态内容等。

Mod cluster exposes services such as myservice . Mod群集公开服务,例如myservice I disabled mod_cluster and created a Kubernetes service myservice that resolved to the back-end Pod thinking that the Ingress rule would get the request as far as httpd and then httpd would be able to resolve the backend service via Kubernetes but i get 404s as I am unable to resolve myservice 我禁用了mod_cluster并创建了一个Kubernetes服务myservice ,该服务解析到后端Pod,以为Ingress规则可以将请求发送到httpd,然后httpd可以通过Kubernetes解析后端服务,但是我可以得到404无法解决myservice

Service can be resolved via Reverse proxy rules such as below, but this is not preferred solution 可以通过以下反向代理规则来解析服务,但这不是首选解决方案

# Redirect to myjbossserv
ProxyPass /myservice/services/command/  http://myjbossserv:8080/myservice/services/command/          <-----myjbossserv is a service registered in kubernetes
ProxyPassReverse /myservice/services/command/  http://myjbossserv:8080/myservice/services/command/

Any help much appreciated 任何帮助,不胜感激

The simplest way to solve this...catering for all HA and robustness use cases was to use reverse proxy rules. 解决此问题的最简单方法是:满足所有HA和健壮性用例的是使用反向代理规则。 There are multiple ways to configure these such as at image build time or via config maps... 有多种配置方式,例如在映像生成时或通过配置映射...

# Redirect to myjbossserv
ProxyPass /myservice/services/command/  http://myjbossserv:8080/myservice/services/command/          <-----myjbossserv is a service registered in kubernetes
ProxyPassReverse /myservice/services/command/  http://myjbossserv:8080/myservice/services/command/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kubernetes 上的 Docker nginx 反向代理 - Docker nginx reverse proxy on Kubernetes 在kubernetes集群上部署zuul代理 - Deploying zuul proxy on kubernetes cluster 无法在 AWS Kubernetes 集群上设置没有反向代理(“存储库路径”Docker 访问方法)的 JFrog Artifactory Pro(试用版) - Unable to setup JFrog Artifactory Pro (Trial) without reverse proxy ('Repository Path' Docker Access Method) on AWS Kubernetes cluster 如何在kubernetes中将nginx设置为rest microservice的反向代理? - How to setup nginx as reverse proxy for rest microservice in kubernetes? 在企业防火墙/代理服务器后面运行 kubernetes kubeadm 集群 - Running kubernetes kubeadm cluster behind a corporate firewall/proxy server 将 Nginx 反向代理迁移到 traefik =&gt; 服务无法正确提供 - Migrating Nginx reverse proxy to traefik => Services do not get served correctly nginx docker 容器作为在 docker 容器中运行的服务的反向代理 - nginx docker container as reverse proxy for services running in docker containers 反向代理NGINX前端以重定向Dockerized Apache - Reverse proxy NGINX front-end to redirect Dockerized Apache React prod 构建前端不使用代理访问后端 - React prod build front end not using proxy to access back end 如何为kubernetes(v1.11.2)集群设置代理设置(http_proxy变量)? - How to set proxy settings (http_proxy variables) for kubernetes (v1.11.2) cluster?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM