Update README.md

This commit is contained in:
Dominik Chilla 2020-08-23 18:47:46 +02:00 committed by GitHub
parent a856691295
commit 8cc2cda6a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,13 +67,15 @@ spec:
- --validating-webhook=:8443
- --validating-webhook-certificate=/usr/local/certificates/cert
- --validating-webhook-key=/usr/local/certificates/key
*** ADD >>> - --tcp-services-configmap=ingress-nginx/tcp-services <<< ADD ***
*** ADD >>> - --udp-services-configmap=ingress-nginx/udp-services <<< ADD ***
>>> ADD
- --tcp-services-configmap=ingress-nginx/tcp-services
- --udp-services-configmap=ingress-nginx/udp-services
<<< ADD
env:
[...]
```
### Deploy nginx-service and expose via nginx-ingress on TCP-port 9000
### Deploy my-nginx-service and expose via nginx-ingress on TCP-port 9000
my-nginx-deployment.yml:
```
apiVersion: apps/v1
@ -129,7 +131,9 @@ Find the `ports:`-section of the `ingress-nginx-controller` service and *ADD* th
[...]
spec:
clusterIP: 10.43.237.255
externalTrafficPolicy: Cluster
>>> CHANGE externalTrafficPolicy from Cluster to Local if original client-IP is desirable
externalTrafficPolicy: Local
<<< CHANGE
ports:
- name: http
nodePort: 30312
@ -141,12 +145,12 @@ spec:
port: 443
protocol: TCP
targetPort: https
*** ADD >>>
>>> ADD
- name: proxied-tcp-9000
port: 9000
protocol: TCP
targetPort: 9000
<<< ADD ***
<<< ADD
[...]
```
Finally, we need to glue nginx-ingress with the my-nginx app. This will be done with the config-map `tcp-services-config-map.yml` referenced earlier in the nginx-ingress deployment definition:
@ -158,7 +162,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`:
```
@ -185,3 +189,15 @@ dominik@muggler:~$ curl -s http://10.62.94.246:9000
</body>
</html>
```
Check logs of my-nginx POD:
```
root@k3s-master:/k3s# kubectl get pods
NAME READY STATUS RESTARTS AGE
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 "-" "-" "-"
[...]
```