I currently have a load balancer per pod. In my instance 2 pods with the following YAML definitions.
apiVersion: v1
kind: Service
metadata:
name: service1
spec:
ports:
- name: https-service1
port: 6379
targetPort: 6379
selector:
app: service1-consoleapp
type: LoadBalancer
apiVersion: v1
kind: Service
metadata:
name: service2
spec:
ports:
- name: https-service2
port: 443
targetPort: 443
selector:
app: service2-consoleapp
type: LoadBalancer
When I apply the above 2 yaml files I will get 2 external ip's that I then use to configure my A records in my dns subdomains.
service1.company.com => external ip 1 for service1-consoleapp
service2.company.com => external ip 2 for service2-consoleapp
Is there a way to combine the YAML file into one, so that I can only use one IP address instead of 2 ?
Also , it looks like in ingress you can do it but not sure how I deal with the "host" requirement.
Can someone please explain how the routing will work as I'm not sure what values should be in the path property ?
Will I still get 2 external ip's on this that I can use to populate the dns subdomains ?
spec:
rules:
- host: service1.company.com
http:
paths:
- backend:
serviceName: service1
servicePort: 6379
path: ??
- host: service2.company.com
http:
paths:
- backend:
serviceName: service2
servicePort: 433
path: ??
The result I'm looking for is if I type
service1.company.com:6379 in my browser then I should hit the pod endpoint (service1-consoleapp) and if I type
service2.company.com:443 in my browser then I should hit the pod endpoint (service2-consoleapp).
where the service1.company.com and service2.company.com is on the same IP address.
thanks in advance.