daemonset

This commit is contained in:
Dominik Chilla 2020-08-26 01:03:31 +02:00
parent f34e081881
commit b2086997a5

View File

@ -10,7 +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) * [Running DaemonSets on `hostPort`](#running-daemonsets)
## Install k3s <a name="install-k3s"></a> ## Install k3s <a name="install-k3s"></a>
https://k3s.io/: https://k3s.io/:
@ -252,9 +252,58 @@ kubectl logs my-nginx-65c68bbcdf-xkhqj -f
[...] [...]
``` ```
# Running postfix in kubernetes <a name="running-postfix-in-kuberentes"></a> # Running DaemonSets on `hostPort` <a name="running-daemonsets"></a>
https://www.tauceti.blog/post/run-postfix-in-kubernetes/ Docs: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
Important in term of Deployment(one node)/Daemonset(all nodes) In this case configuration of networking in context of services are not needed.
* hostNetwork: true
* dnsPolicy: ClusterFirstWithHostNet ```
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: netcat-daemonset
labels:
app: netcat-daemonset
spec:
selector:
matchLabels:
app: netcat-daemonset
template:
metadata:
labels:
app: netcat-daemonset
spec:
containers:
- command:
- nc
- -lk
- -p
- "23456"
- -v
- -e
- /bin/true
env:
- name: DEMO_GREETING
value: Hello from the environment
image: dockreg-zdf.int.zwackl.de/alpine/latest/amd64:prod
imagePullPolicy: Always
name: netcat-daemonset
ports:
- containerPort: 23456
hostPort: 23456
protocol: TCP
resources:
limits:
cpu: 500m
memory: 64Mi
requests:
cpu: 50m
memory: 32Mi
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
updateStrategy:
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
```