mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-23 10:12:38 +01:00
Tidy up examples, StatefulSet example
This commit is contained in:
parent
9d85cfa062
commit
956e092413
1 changed files with 70 additions and 31 deletions
|
@ -297,7 +297,9 @@ This image can be pushed to a container registry and shipped independently. All
|
||||||
|
|
||||||
## Kubernetes
|
## Kubernetes
|
||||||
|
|
||||||
The setup for Kubernetes is very similar to that for Docker, and requires a fairly minimal deployment or pod definition to function.
|
The setup for Kubernetes is very similar to that for Docker, and requires a fairly minimal deployment or pod definition to function. There
|
||||||
|
are a few options to mix and match, including a deployment without a cache file, a stateful set with a persistant cache, and a standalone
|
||||||
|
unmanaged pod.
|
||||||
|
|
||||||
|
|
||||||
=== "deployment"
|
=== "deployment"
|
||||||
|
@ -334,6 +336,59 @@ The setup for Kubernetes is very similar to that for Docker, and requires a fair
|
||||||
- name: config
|
- name: config
|
||||||
configMap:
|
configMap:
|
||||||
name: ntfy
|
name: ntfy
|
||||||
|
---
|
||||||
|
# Basic service for port 80
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: ntfy
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: ntfy
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 80
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "stateful set"
|
||||||
|
```yaml
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: ntfy
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: ntfy
|
||||||
|
serviceName: ntfy
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: ntfy
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: ntfy
|
||||||
|
image: binwiederhier/ntfy
|
||||||
|
args: ["serve", "--cache-file /var/cache/ntfy/cache.db"]
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
name: http
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: "/etc/ntfy"
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: ntfy
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: cache
|
||||||
|
spec:
|
||||||
|
accessModes: [ "ReadWriteOnce" ]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "pod"
|
=== "pod"
|
||||||
|
@ -383,19 +438,3 @@ Configuration is relatively straightforward. As an exmaple, a minimal configurat
|
||||||
```bash
|
```bash
|
||||||
kubectl create configmap ntfy --from-file=server.yml
|
kubectl create configmap ntfy --from-file=server.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
A small service is also required to properly route your traffic to the pod - it is recommended to use an ingress, but a NodePort may also
|
|
||||||
be acceptable.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: ntfy
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: ntfy
|
|
||||||
ports:
|
|
||||||
- port: 80
|
|
||||||
targetPort: 80
|
|
||||||
```
|
|
Loading…
Reference in a new issue