tcp-services without PROXY-protocol

This commit is contained in:
Dominik Chilla 2020-08-25 15:14:03 +02:00
parent 46dd15ee80
commit f34e081881

View File

@ -187,7 +187,7 @@ metadata:
name: tcp-services
namespace: ingress-nginx
data:
"9000": default/my-nginx:80::PROXY
"9000": default/my-nginx:80
```
Apply with `kubectl apply -f tcp-services-config-map.yml`:
```
@ -200,14 +200,45 @@ Subsequently the config-map can be edited with `kubectl edit configmap tcp-servi
## Test exposed app on TCP-port 9000 <a name="test-nginx-ingress-and-tcp-service"></a>
```
dominik@muggler:~$ curl -s http://10.62.94.246:9000
<!DOCTYPE html>
<html>
<head><title>400 Bad Request</title></head>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.19.2</center>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
```
Check logs of ingress-nginx-controller POD:
```
root@k3s-master:~# kubectl get pods --all-namespaces |grep ingress-nginx
[...]
ingress-nginx ingress-nginx-controller-d88d95c-khbv4 1/1 Running 0 4m36s
[...]
```
```
root@k3s-master:~# kubectl logs ingress-nginx-controller-d88d95c-khbv4 -f -n ingress-nginx
[...]
[10.62.94.1] [23/Aug/2020:16:38:33 +0000] TCP 200 850 81 0.001
[...]
```
Check logs of my-nginx POD:
```
root@k3s-master:/k3s# kubectl get pods
@ -217,7 +248,7 @@ my-nginx-65c68bbcdf-xkhqj 1/1 Running 0 90m
```
kubectl logs my-nginx-65c68bbcdf-xkhqj -f
[...]
10.42.0.18 - - [23/Aug/2020:16:38:33 +0000] "PROXY TCP4 10.62.94.1 10.42.0.18 48558 9000" 400 157 "-" "-" "-"
10.42.0.18 - - [23/Aug/2020:16:38:33 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.64.0" "-"
[...]
```