I am currently running a small K3S cluster in order to get familiar with K8S.
I am able to set up pods with ordinary LoadBalancers and get it to work without any problem. However, when I try to get it to work with Ingresses (HAProxy in my case) - I only end up with "default backend -404".
This is the deployment of the pods, based on the default NGINX container:
apiVersion: apps/v1
kind: Deployment
metadata:
name: notesncrap
labels:
app: notesncrap
spec:
replicas: 2
selector:
matchLabels:
app: notesncrap
template:
metadata:
labels:
app: notesncrap
spec:
containers:
- name: notesncrap
image: jselea/notesncrap
ports:
- containerPort: 80
I have also created a Service:
apiVersion: v1
kind: Service
metadata:
name: notesncrap
labels:
app: notesncrap
spec:
ports:
- port: 80
selector:
app: notesncrap
tier: frontend
And now the Ingress:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: notesncrap
spec:
rules:
- host: k8scrap.selea.se
http:
paths:
- path: /
backend:
serviceName: notesncrap
servicePort: 80
I have the understanding that the name and label should be consistent over the .yaml files, and I personally can't see anything really wrong with what I have written.
Thankful for any pointers
EDIT:
As pointed out by the comments - the Ingress is behind a Apache Reverseproxy:
ProxyPass "/" "http://x.x.x.x:80"
ProxyPassReverse "/" "http://x.x.x.x:80"
ProxyRequests On
ProxyPreserveHost On
When I try curl directly against the ingress:
╭─root@sshgateway ~
╰─➤ curl -H "Host:k8scrap.selea.se" http://x.x.x.x
default backend - 404#