miador
miador

Reputation: 368

Deploying Quarkus Apps with Kubernetes

I'm trying to deploy an example Quarkus app with Kubernetes. Everything is fine when i run it in dev mode as mvn quarkus:dev -Dquarkus.http.port=8080. But when i deploy and go to the endpoint localhost/rest-json it says RESTEASY003210: Could not find resource for full path: http://rest-json-http/. i'm using ingress-nginx. What am i missing? Is there anything wrong with the k8s manifests?

Here is my application.yml:

quarkus:
  http:
    cors:
      ~: true
    root-path: /rest-json

deployment.yml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rest-json
  namespace: default
  labels:
    app: rest-json
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rest-json
  template:
    metadata:
      labels:
        app: rest-json
    spec:
      containers:
        - name: rest-json
          image: quarkus/rest-json-jvm:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8080

service.yml:

apiVersion: v1
kind: Service
metadata:
  name: rest-json-http
  namespace: default
spec:
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
      name: http
  selector:
    app: rest-json

ingress.yml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: rest-json-ingress
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: "/"
    nginx.ingress.kubernetes.io/upstream-vhost: "rest-json-http"
spec:
  rules:
    - host: localhost
      http:
        paths:
          - path: /rest-json
            pathType: Prefix
            backend:
              service:
                name: rest-json-http
                port:
                  number: 8080

Here is repo to reproduce github.com/miador/rest-json-quickstart

Upvotes: 0

Views: 674

Answers (1)

David B G Dutra
David B G Dutra

Reputation: 51

Try to change this:

nginx.ingress.kubernetes.io/rewrite-target: "/$1"

and this:

- path: /rest-json/(.+)

and then access: http://localhost/rest-json/fruits.html

Here you can see more about ingress path matching.

Upvotes: 2

Related Questions