-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add Kubernetes examples & documentation (#402)
Fix #396
- Loading branch information
Showing
10 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 .` . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- deployment.yaml | ||
- secret-config.yaml | ||
- service.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"}]}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 18 additions & 0 deletions
18
k8s/overlay/with-ingress-tls-cert-manager/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |