Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes Ingress controllers for wildcard url mapping

I need for each of my users to access a service at a custom url eg. abccompany.mycloudapp.com , each service being a kubernetes service I'm looking at ingress controllers but I need a way to use a wildcard host field and somehow read the value into the path: and service: fields ; here's a sample ingress controller of what I have in mind:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
 name: test
spec:
 rules:
 - host: *.bar.com
   http:
     paths:
     - path: /{{ value of * in * .bar.com }}
       backend:
         serviceName: {{value of * in *.bar.com }}Svc
         servicePort: 80
like image 963
Jonathan Avatar asked Jun 25 '16 11:06

Jonathan


People also ask

Can you have multiple ingress controllers in Kubernetes?

You may deploy any number of ingress controllers using ingress class within a cluster. Note the . metadata.name of your ingress class resource.

Does ingress controller need to be in same namespace?

You can spread the Ingress configuration for a common host across multiple Ingress resources using Mergeable Ingress resources. Such resources can belong to the same or different namespaces.

What is the difference between ingress controller and ingress resource?

An ingress controller is a configurable proxy running in the cluster that is typically composed of a control plane and a data plane. Configuration objects will vary depending on the ingress controller you are using. An ingress resource is a standard configuration object for an ingress controller.

How many ingress controllers are currently supported in Kubernetes?

0), you can deploy two Ingress controllers by granting them control over two different IngressClasses, then selecting one of the two IngressClasses with ingressClassName .


1 Answers

If you use the stock controllers you will be able to switch on hostname and go to different backends services. It sounds like you don't want to enumerate all the subdomains -> service mappings, in which case you probably need to write your own controller that writes out an nginx config that uses $http_host in the appropriate proxy_pass or redirect lines. Give it a shot (https://github.com/kubernetes/contrib/tree/master/ingress/controllers) and file bugs in that same repo if you need help.

like image 194
Prashanth B Avatar answered Nov 15 '22 14:11

Prashanth B