0

I have a two independent application which I deployed via helm and have different SCM repository.I would like to expose both of them via ingress using Openstack Loadbalancer DNS. my aim is to access both application such as hostname:8000 for application 1 and hostname:8080 for application2.

Is there any way to handle this via traefik or kubernetes?

Application 1

service:
  type: NodePort
  port: 8000

networkPolicy:
  enabled: true

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: traefik
  hosts:
    - host: hostname -> just for example
      paths: [/]
  tls: []

Application 2

service:
  type: NodePort
  port: 8080

networkPolicy:
  enabled: true

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: traefik
  hosts:
    - host: hostname -> just for example
      paths: [/]
  tls: []
semural
  • 3,583
  • 8
  • 37
  • 67

2 Answers2

4
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: samehostexample
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.frontend.rule.type: PathPrefixStrip
spec:
  rules:
  - host: hostname.com
    http:
      paths:
      - path: /service1path
        backend:
          serviceName: service1
          servicePort: 8000
      - path: /service2path
        backend:
          serviceName: service2
          servicePort: 8080
Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107
3

If you have single host

apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: staging-ingress
      annotations:
        kubernetes.io/ingress.class: "nginx"
    spec:
      rules:
      - host: test.example.com
        http:
          paths:
          - path: /
            backend:service-1
              servicePort: 80
          - path: /api
            backend:
              serviceName: service-2
              servicePort: 80

Multiple hosts

spec:
  rules:
  - host: test-webapp-example.com
    http:
      paths:
        - path: /
          backend:
            serviceName: test-webapp-example
            servicePort: 80
  - host: test-another-example.com
    http:
      paths:
        - path: /
          backend:
            serviceName: test-webapp-somethingelse
            servicePort: 80
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102