公开集群内部的入口路径,但不公开? [英] Expose ingress path inside cluster but not on public?

查看:48
本文介绍了公开集群内部的入口路径,但不公开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有以下图表的吊舱:

I have a pod that has following chart:

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
    // ...
  paths:
    - /api/myservice

我的pod公开了api,另外还公开了一个/prometheus 端点,可通过/api/myservice/prometheus 访问该端点.

My pod exposes api and additionally a /prometheus endpoint that is accessible through /api/myservice/prometheus.

我想在群集中看到 prometheus ,但不能从/api/myservice/prometheus 中看到.我该如何实现?

I would like to have prometheus visible inside my cluster but not from /api/myservice/prometheus. How I can achieve that?

推荐答案

您可以添加一个Ingress规则,将端点重定向到default-backend:

You can add an Ingress rule that redirects the endpoint to the default-backend:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: block
  annotations:
    ingress.kubernetes.io/ssl-redirect: "true"
    ingress.kubernetes.io/rewrite-target: /
spec:
  tls:
  - hosts:
    - myapp.to
  rules:
  - host: myapp.to
    http:
      paths:
      - path: /metrics
        backend:
          serviceName: ingress-default-backend
          servicePort: 8080

这篇关于公开集群内部的入口路径,但不公开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆