re-format and cleanup
parent
2fb7523d06
commit
0234041e1e
|
@ -439,42 +439,43 @@ Configuration is relatively straightforward. As an example, a minimal configurat
|
||||||
kubectl create configmap ntfy --from-file=server.yml
|
kubectl create configmap ntfy --from-file=server.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Kustomization
|
## Kustomize
|
||||||
Create new folder, name it nfty and create kustomization.yaml within along all resources listed below.
|
|
||||||
Ingress is optional - you can skip this one if planning to expose service using different service type (hash it out from kustomization file)
|
|
||||||
|
|
||||||
|
`ntfy` can be deployed in Kubernetes cluster with [Kustomize](https://github.com/kubernetes-sigs/kustomize) - tool used to customize Kubernetes objects using kustomization file.
|
||||||
|
|
||||||
|
1. Create new folder - `ntfy`
|
||||||
|
2. Add all files listed below
|
||||||
|
1. kustomization.yaml - stores all configmaps and resources used in deployment
|
||||||
|
2. ntfy-deployment.yam - define deployment type and it's parameters-
|
||||||
|
3. ntfy-pvc.yaml - describes how [persistent volume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) will be created
|
||||||
|
4. ntfy-svc.yaml - expose application to the internal kubernetes network
|
||||||
|
5. ntfy-ingress.yaml - expose service to outside network using [Ingress controller](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/)
|
||||||
|
6. server.yaml - simple server configuration
|
||||||
|
4. Replace **TESTNAMESPACE** within kustomization.yaml with designated namespace
|
||||||
|
5. Replace **ntfy.test** within ntfy-ingress.yaml with desired DNS name
|
||||||
|
6. Apply configuration to cluster set in current context:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -k /ntfy
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "kustomization.yaml"
|
||||||
```yaml
|
```yaml
|
||||||
|
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- ntfy-deployment.yaml # main deployment
|
- ntfy-deployment.yaml # deployment definition
|
||||||
- ntfy-svc.yaml # service connecting two pods together
|
- ntfy-svc.yaml # service connecting pods to cluster network
|
||||||
- ntfy-pvc.yaml # pvc uset to store cache and attachment
|
- ntfy-pvc.yaml # pvc used to store cache and attachment
|
||||||
- ntfy-ingress.yaml # ingress traefik
|
- ntfy-ingress.yaml # ingress definition
|
||||||
|
|
||||||
configMapGenerator: # will parse config from raw config to configmap,it allows for dynamic reload of application if additional app is deployed ie https://github.com/stakater/Reloader
|
configMapGenerator: # will parse config from raw config to configmap,it allows for dynamic reload of application if additional app is deployed ie https://github.com/stakater/Reloader
|
||||||
- name: server-config
|
- name: server-config
|
||||||
files:
|
files:
|
||||||
- server.yml
|
- server.yml
|
||||||
|
namespace: TESTNAMESPACE # select namespace for whole application
|
||||||
namespace: TESTNAMESPACE # select namaespace for whole application
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1 #local resources
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- git@github.com:gituser/kustomize.git/kustomize/main/ #WIP when complete config will be stored in repo
|
|
||||||
|
|
||||||
namespace: TESTNAMESPACE # select namaespace for whole application
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
=== "ntfy-deployment.yaml"
|
||||||
### ntfy-deployment.yaml
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -494,7 +495,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: ntfy
|
- name: ntfy
|
||||||
image: binwiederhier/ntfy:v1.28.0 # select version here latest is not the greatest idea !
|
image: binwiederhier/ntfy:v1.28.0 # set deployed version
|
||||||
args: ["serve"]
|
args: ["serve"]
|
||||||
env: #example of adjustments made in environmental variables
|
env: #example of adjustments made in environmental variables
|
||||||
- name: TZ # set timezone
|
- name: TZ # set timezone
|
||||||
|
@ -530,8 +531,7 @@ spec:
|
||||||
claimName: ntfy-pvc
|
claimName: ntfy-pvc
|
||||||
```
|
```
|
||||||
|
|
||||||
### ntfy-pvc.yaml
|
=== "ntfy-pvc.yaml"
|
||||||
Stores all in cache folder for event of the pod re-deployment
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
|
@ -544,11 +544,9 @@ spec:
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 1Gi
|
storage: 1Gi
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### ntfy-svc.yaml
|
=== "ntfy-svc.yaml"
|
||||||
Exposes pod to internal network of the cluster
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
@ -565,9 +563,7 @@ spec:
|
||||||
targetPort: http-ntfy
|
targetPort: http-ntfy
|
||||||
```
|
```
|
||||||
|
|
||||||
### ntfy-ingress.yaml
|
=== "ntfy-ingress.yaml"
|
||||||
If cluster uses Ingress controller you have to deploy ingress to access application externally. It will not have TLS/SSL enabled so you have to deploy cert-manager and generate CA cert along certificate for service
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
|
@ -587,16 +583,8 @@ spec:
|
||||||
number: 80
|
number: 80
|
||||||
```
|
```
|
||||||
|
|
||||||
### server.yml
|
=== "server.yml"
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
cache-file: "/var/cache/ntfy/cache.db"
|
cache-file: "/var/cache/ntfy/cache.db"
|
||||||
attachment-cache-dir: "/var/cache/ntfy/attachments"
|
attachment-cache-dir: "/var/cache/ntfy/attachments"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploying from kustomization
|
|
||||||
Go one level up from folder where all resources were created and apply configuration
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl apply -k /nfty
|
|
||||||
```
|
|
Loading…
Reference in New Issue