DDCLient
DDClient is a Dynamic DNS (DDNS) tool to check what your external IP address is and then update your DNS service with your new IP when it changes. It supports many services, including Google and Cloudflare.
Product: DDCLient
Install Type: Manifest Files
Container Image: LinuxServer.io
Installation Details
Before beginning your installation, I'd recommend reading through the DDClient Documentation to get an idea of what is needed for your particular installation and how to create your configuration file.
Because this is a "headless" service (with no direct user interaction) we will not be defining any services or ingresses. However I will share some scripts to help manage your configuration at the end.
Now let's create the files we'll need to configure DDClient in Kubernetes
The following manifest files assume you will want to install this to a namespace named utility.
00-utility-namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: utility
labels:
name: utility
01-config.yaml
The configuration is mostly stored in the ddclient.conf file and there is not much to define here. This file could be eliminated all together and the settings configured with the deployment. I tend to define things separately to maintain consistency in my configurations
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ddclient-configs
namespace: utility
data:
TZ: "America/New York"
02-storage.yaml
This container does store config files on the file system I defined a 10 MB config volume using Longhorn for this volume.
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: utility
name: ddclient-data
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 10Mi
03-deploy.yaml
The Deployment brings together the configuration and storage with the container image:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ddclient
namespace: utility
labels:
app: ddclient
app.kubernetes.io/name: ddclient
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: ddclient
template:
metadata:
labels:
app: ddclient
app.kubernetes.io/name: ddclient
spec:
volumes:
- name: ddclient-data
persistentVolumeClaim:
claimName: ddclient-data
containers:
- name: ddclient
image: lscr.io/linuxserver/ddclient:latest
imagePullPolicy: Always
volumeMounts:
- name: ddclient-data
mountPath: /config
envFrom:
- configMapRef:
name: ddclient-configs
build-ddclient.sh
Now that we have prepared our manifests we need to deploy them to the cluster with kubectl. I create shell scripts for all my deployments so I can quickly redeploy if I make any adjustments. The below script does assume you have configured kubectl properly already.
#!/bin/bash
kubectl apply -f 00-utility-namespace.yaml \
-f 01-config.yaml \
-f 02-storage.yaml \
-f 03-deploy.yaml
We can deploy the manifests for DDClient to the Kubernetes cluster by executing the following:
chmod 755 build-ddclient.sh
./build-ddclient.sh
I keep all my manifests, scripts, and helm charts in a private git repository for version control and archival storage. While it is certainly not required to deploy Mealie, it has made my life a little easier.
Configuring DDClient
You'll want to consult the DDClient Documentation for specific information about your setup, but I've included an example of a configuration that I use successfully with Cloudflare.
I utilize my Global API Key (found in your Cloudflare Profile under API Keys). Be sure to keep this file in a private and secure location
ddclient.conf
daemon=300 # check every 300 seconds
syslog=yes # log update msgs to syslog
pid=/run/ddclient/ddclient.pid # record PID in file.
ssl=yes # use ssl-support. Works with
use=web # get IP with website below
web='https://cloudflare.com/cdn-cgi/trace'
##
## CloudFlare (www.cloudflare.com)
##
protocol=cloudflare, \
zone=your.domain, \
ttl=1, \
login='YourCloudFlareUserName', \
password='YourAPITokenFromCloudflare' \
subdomain1.your.zone,subdomain2.your.zone,subdomain3.your.zone
Administering DDClient Configs
DDClient is setup to automatically pick up changes to the ddclient.conf file. This means that you can adjust your ddclient.conf file and put it in the pod and the service will automatically apply it. Because of this, I keep my ddclient.conf file with my manifest files and store it in a git repository for easy version control. I also wrote this quick script that will place the new ddclient.conf file into your pod after you make any changes to it.
update-ddclient.sh
#!/bin/bash
CONTAINER=$(kubectl get pods -n utility|grep ddclient|awk '{print $1}')
echo "Updating the ddclient.conf file on $CONTAINER"
kubectl cp ddclient.conf $CONTAINER:config/ddclient.conf -n utility
kubectl exec -it -n utility $CONTAINER -- bash -c "chown abc:abc /config/ddclient.conf"
After creating the file, be sure to remember to make it executable
chmod 755 ddclient-config.sh
Now, after you make any changes to your ddclient.conf file you can update your pod with these changes easily by executing:
./ddclient-update.sh
This will copy your ddclient.conf file (located in the same directory) to your ddclient pod and then update the permissions of the file to the runtime user of the pod. From there the DDCLient pod will automatically pick up the config changes and apply them.