Kubernetes nginx-ingress host

I am trying to configure my ingress to expose one of my services for any request for a host ending with .mywebsite.com

I tried *.mywebsite.com but it does not work. Is there a way to configure the ingress to do so ?

My sub-domains are dynamically handled by the service, and the DNS is configured with a wildcard record.

Upvotes: 0

Views: 416

Answers (1)

Pulak Kanti Bhowmick
Pulak Kanti Bhowmick

Reputation: 1255

You can try the below manifest file.

Prerequisite: k8s version 1.19+

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-wildcard-host
spec:
  rules:
  - host: "*.mywebsite.com"
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: <your_service_name_here>
            port:
              number: <port_number_here>

Upvotes: 2

Related Questions