mirror of
https://github.com/qdm12/ddns-updater.git
synced 2026-04-05 08:54:09 -04:00
38
k8s/README.md
Normal file
38
k8s/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# Kubernetes
|
||||
|
||||
This directory has example plain Kubernetes manifests for running DDNS-updater in Kubernetes.
|
||||
|
||||
The Manifests have additional [Kustomize](https://kustomize.io/) overlays, which can be used to add an [ingress-route](https://kubernetes.io/docs/concepts/services-networking/ingress/) to ddns-updater.
|
||||
|
||||
1. Download the template files from the [`base` directory](base). For example with:
|
||||
|
||||
```sh
|
||||
curl -O https://raw.githubusercontent.com/qdm12/ddns-updater/master/k8s/base/deployment.yaml
|
||||
curl -O https://raw.githubusercontent.com/qdm12/ddns-updater/master/k8s/base/secret-config.yaml
|
||||
curl -O https://raw.githubusercontent.com/qdm12/ddns-updater/master/k8s/base/service.yaml
|
||||
curl -O https://raw.githubusercontent.com/qdm12/ddns-updater/master/k8s/base/kustomization.yaml
|
||||
```
|
||||
|
||||
1. Modify `secret-config.yaml` as described in the [project readme](../README#configuration)
|
||||
1. Use [kubectl](https://kubernetes.io/docs/reference/kubectl/) to apply the manifest:
|
||||
|
||||
```sh
|
||||
kubectl apply -k .
|
||||
```
|
||||
|
||||
1. Connect the the web UI with a [kubectl port-forward](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/)
|
||||
|
||||
```sh
|
||||
kubectl port-forward svc/ddns-updater 8080:80
|
||||
```
|
||||
|
||||
The web UI should now be available at [http://localhost:8080](http://localhost:8080).
|
||||
|
||||
## Advanced usage
|
||||
|
||||
Kustomize overlays can extend the installation:
|
||||
|
||||
* [overlay/with-ingress](overlay/with-ingress/) - Basic **HTTP** Ingress ressource
|
||||
* [overlay/with-ingress-cert-manager](overlay/with-ingress-cert-manager/) - Basic **HTTPS** Ingress ressource which uses [cert-manager](https://github.com/cert-manager/cert-manager) to create certificates.
|
||||
|
||||
To install with the overlay **just change dirctory in the overlay folder you want to install** and hit `kubectl apply -k .` .
|
||||
23
k8s/base/deployment.yaml
Normal file
23
k8s/base/deployment.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ddns-updater
|
||||
labels:
|
||||
app: ddns-updater
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ddns-updater
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: ddns-updater
|
||||
spec:
|
||||
containers:
|
||||
- name: ddns
|
||||
image: qmcgaw/ddns-updater:latest
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: ddns-updater-config
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
6
k8s/base/kustomization.yaml
Normal file
6
k8s/base/kustomization.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- deployment.yaml
|
||||
- secret-config.yaml
|
||||
- service.yaml
|
||||
7
k8s/base/secret-config.yaml
Normal file
7
k8s/base/secret-config.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: ddns-updater-config
|
||||
type: Opaque
|
||||
stringData:
|
||||
CONFIG: '{"settings":[{"provider":"ddnss","provider_ip":true,"domain":"YOUR-DOMAIN","host":"@","username":"YOUR-USERNAME","password":"YOUR-PASSWORD","ip_version":"ipv4"}]}'
|
||||
12
k8s/base/service.yaml
Normal file
12
k8s/base/service.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ddns-updater
|
||||
spec:
|
||||
selector:
|
||||
app: ddns-updater
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 8000
|
||||
23
k8s/overlay/with-ingress-tls-cert-manager/ingress.yaml
Normal file
23
k8s/overlay/with-ingress-tls-cert-manager/ingress.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: default
|
||||
ingress.kubernetes.io/force-ssl-redirect: "true"
|
||||
name: ddns-updater
|
||||
spec:
|
||||
rules:
|
||||
- host: localhost
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
service:
|
||||
name: ddns-updater
|
||||
port:
|
||||
number: 80
|
||||
tls:
|
||||
- hosts:
|
||||
- localhost
|
||||
secretName: ddns-updater-tls
|
||||
18
k8s/overlay/with-ingress-tls-cert-manager/kustomization.yaml
Normal file
18
k8s/overlay/with-ingress-tls-cert-manager/kustomization.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ../../base
|
||||
- ingress.yaml
|
||||
|
||||
# this patches the hostname of the Ingress
|
||||
patches:
|
||||
- patch: |-
|
||||
- op: replace
|
||||
path: /spec/rules/0/host
|
||||
value: localhost # add your fqdn
|
||||
- op: replace
|
||||
path: /spec/tls/0/hosts/0
|
||||
value: localhost # add your fqdn
|
||||
target:
|
||||
kind: Ingress
|
||||
name: ddns-updater
|
||||
16
k8s/overlay/with-ingress/ingress.yaml
Normal file
16
k8s/overlay/with-ingress/ingress.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ddns-updater
|
||||
spec:
|
||||
rules:
|
||||
- host: localhost
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
service:
|
||||
name: ddns-updater
|
||||
port:
|
||||
name: http
|
||||
15
k8s/overlay/with-ingress/kustomization.yaml
Normal file
15
k8s/overlay/with-ingress/kustomization.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ../../base
|
||||
- ingress.yaml
|
||||
|
||||
# this patches the hostname of the Ingress
|
||||
patches:
|
||||
- patch: |-
|
||||
- op: replace
|
||||
path: /spec/rules/0/host
|
||||
value: localhost # add your fqdn
|
||||
target:
|
||||
kind: Ingress
|
||||
name: ddns-updater
|
||||
Reference in New Issue
Block a user