Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ingetrate with Nginx Ingress Controller #28

Open
STRRL opened this issue Jul 27, 2023 · 7 comments
Open

Ingetrate with Nginx Ingress Controller #28

STRRL opened this issue Jul 27, 2023 · 7 comments

Comments

@STRRL
Copy link
Owner

STRRL commented Jul 27, 2023

No description provided.

@besscroft
Copy link

您好,不知道目前已经支持了哪些功能?我尝试使用 rewrites,但是无法达到预期效果。
https://github.com/nginxinc/kubernetes-ingress/tree/v3.4.0/examples/ingress-resources/rewrites

kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
  name: steambird-api-yaml-via-cf-tunnel
  namespace: steambird
  annotations:
    kubesphere.io/creator: admin
    nginx.org/rewrites: "serviceName=steambird rewrite=/api-docs"
  finalizers:
    - strrl.dev/cloudflare-tunnel-ingress-controller-controlled
spec:
  ingressClassName: cloudflare-tunnel
  rules:
    - host: steambird-api-yaml.besscroft.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: steambird
                port:
                  number: 8000

感谢您能看到这里,我不确定是不能这样用,还是我配置错误。但是查询文档发现 Nginx Ingress 似乎是支持这个注解的,而且也有官方示例。
谢谢!

@omegazeng
Copy link
Contributor

您好,不知道目前已经支持了哪些功能?我尝试使用 rewrites,但是无法达到预期效果。 https://github.com/nginxinc/kubernetes-ingress/tree/v3.4.0/examples/ingress-resources/rewrites

kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
  name: steambird-api-yaml-via-cf-tunnel
  namespace: steambird
  annotations:
    kubesphere.io/creator: admin
    nginx.org/rewrites: "serviceName=steambird rewrite=/api-docs"
  finalizers:
    - strrl.dev/cloudflare-tunnel-ingress-controller-controlled
spec:
  ingressClassName: cloudflare-tunnel
  rules:
    - host: steambird-api-yaml.besscroft.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: steambird
                port:
                  number: 8000

感谢您能看到这里,我不确定是不能这样用,还是我配置错误。但是查询文档发现 Nginx Ingress 似乎是支持这个注解的,而且也有官方示例。 谢谢!

应该是还没有实现这个功能,同时推荐使用ingress-nginx ,而不是nginx-ingress

@STRRL
Copy link
Owner Author

STRRL commented Dec 28, 2023

Hi @besscroft, 目前这个想法还在 draft 阶段, 并没有真正实现它.

如果需要的话可以考虑和 ingress-nginx 嵌套使用.

@besscroft
Copy link

@STRRL @omegazeng 感谢回复,我抽空尝试一下😊,需要学习的内容还有挺多。

@toastedcrumpets
Copy link

Just to add to this discussion you can solve this easily. I just use this controller to tunnel to my NGINX ingress. I.e.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-to-nginx-ingress
  namespace: ingress-nginx
  annotations:
    cloudflare-tunnel-ingress-controller.strrl.dev/backend-protocol: https
    cloudflare-tunnel-ingress-controller.strrl.dev/proxy-ssl-verify: "off"
spec:
  ingressClassName: cloudflare-tunnel
  rules:
  - host: "*.example.com"
    http:
      paths:
      - backend:
          service:
            name: ingress-nginx-controller
            port:
              number: 443
        path: /
        pathType: Prefix

Now I can use ingressClassName: nginx and provided the ingresses are subdomains of example.com, then it magically works.
You can basically ignore the cloudflare-ingress controller once its setup, and use authelia on your nginx ingress.
Thanks again for an amazing ingress controller! Really looking forward to the next release with the latest pulls.

@monlor
Copy link

monlor commented May 28, 2024

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-to-nginx-ingress
  namespace: ingress-nginx
  annotations:
    cloudflare-tunnel-ingress-controller.strrl.dev/backend-protocol: https
    cloudflare-tunnel-ingress-controller.strrl.dev/proxy-ssl-verify: "off"
spec:
  ingressClassName: cloudflare-tunnel
  rules:
  - host: "*.example.com"
    http:
      paths:
      - backend:
          service:
            name: ingress-nginx-controller
            port:
              number: 443
        path: /
        pathType: Prefix

nice idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@toastedcrumpets @omegazeng @STRRL @monlor @besscroft and others