Spring Boot Eureka - CSS does not show up on a Kubernetes / Ingress

12/31/2019

I am running Spring Boot Eureka on AKS (Azure Kubernetes) with a ingress to the the Eureka POD, there is no issue in loading the UI but the CSS and the wor.js does not load.

application.properties

eureka:
  dashboard:
    enabled: true
    path: /webui

Ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: discovery-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  rules:
  - http:
      paths:
      - path: /discovery(/|$)(.*)
        backend:
         serviceName: discovery
         servicePort: 8761

I am new to Ingress so trying to figure out how to map the:

   <link rel="stylesheet" href="eureka/css/wro.css">

and the

    <script type="text/javascript" src="eureka/js/wro.js" ></script>

so that he default ingress backend does not give a 404.

-- runnercoder
kubernetes
spring-boot

1 Answer

1/1/2020

Typically Ingress gives you an external endpoint like eureka.example.com so your javascript should be loaded in the form of https://eureka.example.com/js/wro.js

Also please use https://github.com/spring-cloud/spring-cloud-kubernetes so that spring-cloud and Kubernetes do not step on each other toes.

-- Tummala Dhanvi
Source: StackOverflow