#!/bin/bash set -ex # Check if the Cloudflare API token is provided as an argument if [ -z "$1" ]; then echo "Error: Missing Cloudflare API token." echo "Usage: $0 " echo "You must provide your Cloudflare API token as a parameter to run this script." exit 1 fi CLOUDFLARE_API_TOKEN=$1 # Add the Bitnami Helm repository helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update # Create the namespace for external DNS kubectl create namespace external-dns # Install the external-dns chart with the provided Cloudflare API token helm install external-dns bitnami/external-dns --namespace external-dns \ --set provider=cloudflare \ --set cloudflare.apiToken="$CLOUDFLARE_API_TOKEN" \ --set txtOwnerId=external-dns