I have setup as below:
One kubernetes cluster with nginx ingress for deployment A. Ingress to deployment has configuration for host example.com
. I want abc.com
to point to example.com
using CNAME but its always throwing SSL error.
If I understand you correctly you need to use Rewrite annotations.
See the example below:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
name: rewrite
namespace: default
spec:
rules:
- host: rewrite.bar.com
http:
paths:
- backend:
serviceName: http-svc
servicePort: 80
path: /something(/|$)(.*)
In this ingress definition, any characters captured by (.*) will be assigned to the placeholder
$2
, which is then used as a parameter in the rewrite-target annotation. For example, the ingress definition above will result in the following rewrites:
- rewrite.bar.com/something
rewrites torewrite.bar.com/
- rewrite.bar.com/something/
rewrites torewrite.bar.com/
- rewrite.bar.com/something/new
rewrites torewrite.bar.com/new
Please let me know if that helped.
EDIT: More options:
create additional Ingresses
use HTTP (80) and generate SSL certificates