Welcome to the documentation for the project. Here, you'll find detailed information on setting up a Kubernetes cluster with dynamic DNS using K3d and Cloudflare.
This project aims to create a Kubernetes cluster with dynamic DNS (DDNS) using K3d and Cloudflare, allowing external access without a static IP address.
Before getting started, make sure you have the following prerequisites in place:
- K3d installed on your local machine
- A Cloudflare account
- Docker or Rancher
- Helm Chart must be installed on your local machine
- A registered domain or subdomain managed by Cloudflare
- API token with the necessary permissions for Cloudflare DNS management
NodePort can be used to quickly and easily create externally accessible services within Kubernetes. In this section, we explain its basic usage, but for more detailed and complex scenarios, you can refer to other documents.
-
Create a Kubernetes Cluster
Use K3d to create a Kubernetes cluster. For example:
k3d cluster create recon
1.1 Create a Kubernetes Cluster
$ kubectl cluster-info
Kubernetes control plane is running at https://0.0.0.0:53401
CoreDNS is running at https://0.0.0.0:53401/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://0.0.0.0:53401/api/v1/namespaces/kube-system/services/https:metrics-server:https/proxy
-
Install ExternalDNS with Helm:
Use Helm to install ExternalDNS into your Kubernetes cluster. Make sure Helm is installed and configured before proceeding.
helm repo add bitnami https://charts.bitnami.com/bitnami helm install external-dns bitnami/external-dns --namespace external-dns --set provider=cloudflare --set cloudflare.apiToken=YOUR_CLOUDFLARE_API_TOKEN --set txtOwnerId=my-identifier
Replace YOUR_CLOUDFLARE_API_TOKEN with your Cloudflare API token. You can customize the txtOwnerId to a unique identifier.
Note: Namespace is important because it determines in which namespace ExternalDNS will run within your Kubernetes cluster. Namespace provides isolation and organization in Kubernetes, allowing you to separate resources for different projects or applications.
The choice of which namespace to run ExternalDNS in depends on the requirements of your project and the preferences of your organization. You can select any namespace, but in most cases, placing ExternalDNS in the namespace of a specific application or project can enhance isolation and organization.
Furthermore, when determining the namespace in which ExternalDNS operates, ensure it aligns with the zone in your Cloudflare account for which DNS records need to be updated. This alignment is essential to ensure the accurate synchronization of DNS records.
https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/cloudflare.md
NAME: external-dns
LAST DEPLOYED: Mon Oct 30 21:15:03 2023
NAMESPACE: dummypage
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: external-dns
CHART VERSION: 6.27.0
APP VERSION: 0.13.6
** Please be patient while the chart is being deployed **
To verify that external-dns has started, run:
kubectl --namespace=dummypage get pods -l "app.kubernetes.io/name=external-dns,app.kubernetes.io/instance=external-dns"