简体   繁体   English

K8s入口从没有证书的域重定向到另一个有证书的域

[英]K8s ingress redirect from domain without cert to another with cert

There is k8s cluster with nginx-ingress.有带有 nginx-ingress 的 k8s 集群。 There is domain without certificate (example.io).有没有证书的域(example.io)。 I want redirect all requests to another my domain with certificate (example.com) without exception about bad certificate on domain example.io in browser.我想将所有请求重定向到另一个带有证书的域(example.com),而浏览器中域 example.io 上的错误证书也不例外。 How can I do it?我该怎么做? Thanks.谢谢。

nginx.ingress.kubernetes.io/permanent-redirect, ingress.kubernetes.io/configuration-snippet didn;t help me. nginx.ingress.kubernetes.io/permanent-redirect, ingress.kubernetes.io/configuration-snippet 没有帮助我。 Example:例子:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: redirect-ingress
  annotations:
  ??????
spec:
  rules:
  - host: example.io
    http:
      paths:
      - path: /
        backend:
          serviceName: some-cluster-service
          servicePort: 2020

You can use nginx.ingress.kubernetes.io/force-ssl-redirect: "true" annotation:可以使用nginx.ingress.kubernetes.io/force-ssl-redirect: "true"注解:

When using SSL offloading outside of cluster (eg AWS ELB) it may be useful to enforce a redirect to HTTPS even when there is no TLS certificate available.在集群外使用 SSL 卸载(例如 AWS ELB)时,即使没有可用的 TLS 证书,强制重定向到 HTTPS 也可能很有用。 This can be achieved by using the nginx.ingress.kubernetes.io/force-ssl-redirect: "true" annotation in the particular resource.这可以通过在特定资源中使用 nginx.ingress.kubernetes.io/force-ssl-redirect: "true" 注释来实现。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM