0

I have the bare metall kubernetes pod running tomcat application on port 8085. If it would be common server, the app would be accessible via http://<server-ip>:8085/app. My goal is to expose the tomcat on Kubernetes node's address and the same port as used in tomcat.

I am able to expose and access app using Node Port service - but it is inconvenient that port is always different. I tried to setup traefik ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-tag2
spec:
  rules:
    - host: kubernetes.example.com #in my conf I use node's domain name
      http:
        paths:
        - path: /test
          backend:
            serviceName: test-tag2
            servicePort: 8085

And I can see result in Traefik's dashboard, but still if I navigate to http://kubernetes.example.com/test/app I get nothing.

I've tried a bunch of ways to configure that and still no luck. Is it actually possible to expose my pod in this way?

char
  • 2,063
  • 3
  • 15
  • 26
Anton
  • 96
  • 6

1 Answers1

1

Did you try specifying a nodePort value in the service yaml? If specified, kubernetes will create service on the specified NodePort. If the nodePort is not available , kubernetes doesn't create the service.

Refer to this answer for more details: https://stackoverflow.com/a/43944385/1237402

Malathi
  • 2,119
  • 15
  • 40
  • Thank you, it works for me. I thought that there could be more elegant way to achieve my goal, but if it's not - I can use this one. – Anton Jul 08 '19 at 11:47