postifx@k

This commit is contained in:
Dominik Chilla 2020-08-24 11:59:21 +02:00
parent a948a15fbd
commit 259844ebdc

View File

@ -10,6 +10,7 @@
* [Deploy my-nginx-service](#deploy-my-nginx-service) * [Deploy my-nginx-service](#deploy-my-nginx-service)
* [Stick the nginx-ingress controler and my-nginx app together](#stick-nginx-ingress-and-tcp-service) * [Stick the nginx-ingress controler and my-nginx app together](#stick-nginx-ingress-and-tcp-service)
* [Test exposed app on TCP-port 9000](#test-nginx-ingress-and-tcp-service) * [Test exposed app on TCP-port 9000](#test-nginx-ingress-and-tcp-service)
* [Running postfix in kubernetes](#running-postfix-in-kuberentes)
## Install k3s <a name="install-k3s"></a> ## Install k3s <a name="install-k3s"></a>
https://k3s.io/: https://k3s.io/:
@ -89,7 +90,7 @@ spec:
``` ```
## Enable client-IP transparency and expose TCP-port 9000 <a name="enable-client-ip-transp-expose-tcp-9000"></a> ## Enable client-IP transparency and expose TCP-port 9000 <a name="enable-client-ip-transp-expose-tcp-9000"></a>
Enable client-IP transparency and expose my-nginx app on nginx-ingress TCP-port 9000: `kubectl edit service -n ingress-nginx ingress-nginx-controller` Enable client-IP transparency (X-Original-Forwarded-For) and expose my-nginx app on nginx-ingress TCP-port 9000: `kubectl edit service -n ingress-nginx ingress-nginx-controller`
Find the `ports:`-section of the `ingress-nginx-controller` service and *ADD* the definition for port 9000: Find the `ports:`-section of the `ingress-nginx-controller` service and *ADD* the definition for port 9000:
``` ```
[...] [...]
@ -186,7 +187,7 @@ metadata:
name: tcp-services name: tcp-services
namespace: ingress-nginx namespace: ingress-nginx
data: data:
9000: "default/my-nginx:80" "9000": default/my-nginx:80::PROXY
``` ```
Apply with `kubectl apply -f tcp-services-config-map.yml`: Apply with `kubectl apply -f tcp-services-config-map.yml`:
``` ```
@ -194,6 +195,8 @@ configmap/tcp-services created
``` ```
Subsequently the config-map can be edited with `kubectl edit configmap tcp-services -n ingress-nginx` Subsequently the config-map can be edited with `kubectl edit configmap tcp-services -n ingress-nginx`
**Changes to config-maps do not take effect on running pods! A re-scale to 0 and back can solve this problem: https://stackoverflow.com/questions/37317003/restart-pods-when-configmap-updates-in-kubernetes**
## Test exposed app on TCP-port 9000 <a name="test-nginx-ingress-and-tcp-service"></a> ## 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 dominik@muggler:~$ curl -s http://10.62.94.246:9000
@ -217,3 +220,10 @@ 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] "PROXY TCP4 10.62.94.1 10.42.0.18 48558 9000" 400 157 "-" "-" "-"
[...] [...]
``` ```
# Running postfix in kubernetes <a> name="running-postfix-in-kuberentes"</a>
https://www.tauceti.blog/post/run-postfix-in-kubernetes/
Important in term of Deployment(one node)/Daemonset(all nodes)
* hostNetwork: true
* dnsPolicy: ClusterFirstWithHostNet