I have a Wildfly with a set of applications, not running in the kubernetes cluster. Lets say one is http://wildfly-external/FOO/
From within the cluster, I want that my cluster applications can reach FOO without knowing the contextPath on the wildfly.
Our approach was to generate a Endpint, Service and an Ingress for this Service containing the path
service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
meta.helm.sh/release-name: dns
meta.helm.sh/release-namespace: test
creationTimestamp: "2020-08-31T17:32:08Z"
labels:
app.kubernetes.io/instance: dns
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: foo
helm.sh/chart: dns-1.0.0-snapshot
name: foo
namespace: test
resourceVersion: "151848872"
selfLink: /api/v1/namespaces/test/services/foo
uid: e5607cd4-ebaf-11ea-9f17-005056a7cff9
spec:
clusterIP: 10.200.149.146
ports:
- name: foo
port: 80
protocol: TCP
targetPort: 13000
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
meta.helm.sh/release-name: dns
meta.helm.sh/release-namespace: test
creationTimestamp: "2020-08-31T17:32:08Z"
generation: 1
labels:
app.kubernetes.io/instance: dns
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: foo
helm.sh/chart: dns-1.0.0-snapshot
name: foo
namespace: test
resourceVersion: "151848901"
selfLink: /apis/extensions/v1beta1/namespaces/test/ingresses/foo
uid: e56cc8c9-ebaf-11ea-9f17-005056a7cff9
spec:
rules:
- http:
paths:
- backend:
serviceName: foo
servicePort: http
path: /FOO
status:
loadBalancer:
ingress:
- ip: 10.6.1.1
Unfortunately when curl http//foo/ inside a pod, I reach the wildfly start page at http://wildfly, not the application at http://wildfly/FOO. This looks like I access the service through http://foo/ and not going through the ingress.
Is it possible to do, what I want to do? Any hints?
From my view, the ingress is on top of service.
The sequence is browser->ingress(application load balance)->service. Now the url http//foo/
is to access service instead of ingress. You can use ingress to mapping context to service with ingress rewrite, but you need visit url with full host name of ingress.
Thanks,