{"id":13645785,"url":"https://github.com/calebdoxsey/kubernetes-cloudflare-sync","last_synced_at":"2025-04-09T20:13:35.382Z","repository":{"id":34063764,"uuid":"150256098","full_name":"calebdoxsey/kubernetes-cloudflare-sync","owner":"calebdoxsey","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-22T15:34:15.000Z","size":237,"stargazers_count":116,"open_issues_count":1,"forks_count":47,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T20:13:31.267Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/calebdoxsey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-25T11:40:54.000Z","updated_at":"2024-12-09T08:02:47.000Z","dependencies_parsed_at":"2024-04-22T16:57:27.225Z","dependency_job_id":"1411622e-fe8c-4482-b572-928b8bdf2870","html_url":"https://github.com/calebdoxsey/kubernetes-cloudflare-sync","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calebdoxsey%2Fkubernetes-cloudflare-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calebdoxsey%2Fkubernetes-cloudflare-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calebdoxsey%2Fkubernetes-cloudflare-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calebdoxsey%2Fkubernetes-cloudflare-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calebdoxsey","download_url":"https://codeload.github.com/calebdoxsey/kubernetes-cloudflare-sync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:02:41.762Z","updated_at":"2025-04-09T20:13:35.363Z","avatar_url":"https://github.com/calebdoxsey.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Kubernetes Cloudflare Sync\n\n\nThis App is intended to run in your Kubernetes Cluster and sync DNS records on Cloudflare with your nodes' IPs.\n\n## Example Usage\nYou can read this article to get an idea on why you would want to use it: http://www.doxsey.net/blog/kubernetes--the-surprisingly-affordable-platform-for-personal-projects\n\n### Build\nGKE provides you with a private cotainer image repository for each cluster.\nThe following two commands build the app and publish into your cluster-specific repository.\n\n`docker build -t gcr.io/PROJECT_ID/kubernetes-cloudflare-sync:latest .`\n`docker push gcr.io/PROJECT_ID/kubernetes-cloudflare-sync:latest`\n\n### Configure\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: kubernetes-cloudflare-sync\n  labels:\n    app: kubernetes-cloudflare-sync\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: kubernetes-cloudflare-sync\n  template:\n    metadata:\n      labels:\n        app: kubernetes-cloudflare-sync\n    spec:\n      serviceAccountName: kubernetes-cloudflare-sync\n      containers:\n      - name: kubernetes-cloudflare-sync\n        image: gcr.io/PROJECT_ID/kubernetes-cloudflare-sync\n        args:\n        - --dns-name=kubernetes.example.com\n        env:\n        - name: CF_API_KEY\n          valueFrom:\n            secretKeyRef:\n              name: cloudflare\n              key: api-key\n        - name: CF_API_EMAIL\n          valueFrom:\n            secretKeyRef:\n              name: cloudflare\n              key: email\n```\n**Important:** Make sure to replace `PROJECT_ID`\n\nThe app needs two types of permissions:\n1. talk to cloudflare and update DNS\n2. get a list of nodes in the cluster and read their IP\n\nThe former requires just the API keys from cloudflare. We can store them as secret in the cluster by running:\n\n`kubectl create secret generic cloudflare --from-literal=email=YOUR_CLOUDFLARE_ACCOUNT_EMAIL_ADDRESS_HERE --from-literal=api-key=YOUR_CLOUDFLARE_GLOBAL_API_KEY_HERE`\n\nFor the latter we create a `clusterrolebinding` in our cluster by running:\n\n`kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user YOUR_EMAIL_ADDRESS_HERE`\n\n**Important:** Make sure this is the same E-Mail as you use for running kubectl.\n\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: kubernetes-cloudflare-sync\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: kubernetes-cloudflare-sync\nrules:\n- apiGroups: [\"\"]\n  resources: [\"nodes\"]\n  verbs: [\"list\", \"watch\"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: kubernetes-cloudflare-sync-viewer\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: kubernetes-cloudflare-sync\nsubjects:\n- kind: ServiceAccount\n  name: kubernetes-cloudflare-sync\n  namespace: default\n```\n\nApplying all configs by running:\n\n`kubectl apply -f .`\n\n#### ENV\n* ```CF_API_EMAIL``` The email address to use for cloudflare\n* ```CF_API_KEY``` The key to use for cloudflare\n* ```CF_API_TOKEN``` The token to use for cloudflare (in lieu of email and key)\n* ```CF_PROXY``` Enable cloudflare proxy on dns (default false)\n* ```CF_TTL``` TTL for dns (default 120)\n* ```DNS_NAME``` The dns name for the nodes, comma-separated for multiple (same root)\n* ```USE_INTERNAL_IP``` Use internal ips too if external ip's are not available\n* ```SKIP_EXTERNAL_IP``` Don't sync external IPs (use in conjunction with --use-internal-ip)\n* ```NODE_SELECTOR``` Node selector query\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalebdoxsey%2Fkubernetes-cloudflare-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalebdoxsey%2Fkubernetes-cloudflare-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalebdoxsey%2Fkubernetes-cloudflare-sync/lists"}