Hi,
I have k3s + traefik(2.5) cluster (as created by AWS Localstack) and I am trying to define an ingress annotation to remove the Host header in HTTP/S. But, I still see HOST header in the pod (using tcpdump). I am not sure what is getting missed in my setup. Do any one have suggestions?
The below are my some of the configuration and manifests.
Ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: "traefik"
traefik.ingress.kubernetes.io/service.passhostheader: "false"
name: envoy-ingress-f9bhxz
namespace: f9bhxz-68ca6294-1867-4fff-9986-c468d6a3cd0b
spec:
rules:
- host: eks-8081.localhost.localstack.cloud
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: myapache
port:
number: 80
svc:
qhuser@localstack:~/localstack/docker/httpo/test$ cat svc.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
alb.ingress.kubernetes.io/target-type: ip
name: myapache
namespace: f9bhxz-68ca6294-1867-4fff-9986-c468d6a3cd0b
labels:
app: myapache
spec:
selector:
app: myapache
ports:
- name: myapache
port: 80
targetPort: 80
deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: myapache
type: front-end
name: myapache
namespace: f9bhxz-68ca6294-1867-4fff-9986-c468d6a3cd0b
spec:
replicas: 1
selector:
matchLabels:
app: myapache
template:
metadata:
labels:
app: myapache
spec:
containers:
- image: localhost.localstack.cloud:4511/ls-apache:latest
name: myapache
$ kubectl get ingress -n f9bhxz-68ca6294-1867-4fff-9986-c468d6a3cd0b
NAME CLASS HOSTS ADDRESS PORTS AGE
envoy-ingress-f9bhxz eks-8081.localhost.localstack.cloud 192.168.240.2 80 13s
$ kubectl get pods -n f9bhxz-68ca6294-1867-4fff-9986-c468d6a3cd0b
NAME READY STATUS RESTARTS AGE
myapache-75c57c89f4-pvkfq 1/1 Running 0 40s
Even still, I am seeing HOST header in the HTTP when I do tcpdump inside the POD.
Tcpdump at the POD:
10-42-0-8.traefik.kube-system.svc.cluster.local.42074 > myapache-75c57c89f4-pvkfq.80: Flags [P.], cksum 0x1738 (incorrect -> 0x522f), seq 1:680, ack 1, win 507, options [nop,nop,TS val 380636648 ecr 2501211320], length 679: HTTP, length: 679
GET / HTTP/1.1
Host: eks-8081.localhost.localstack.cloud:8081
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Pragma: no-cache
Upgrade-Insecure-Requests: 1
X-Forwarded-For: 10.42.0.1
X-Forwarded-Host: eks-8081.localhost.localstack.cloud:8081
X-Forwarded-Port: 8081
X-Forwarded-Proto: http
X-Forwarded-Server: traefik-55fdc6d984-qn7dx
X-Real-Ip: 10.42.0.1
Regards
Yesudian Rajkumar