k8s external dns

k8s external dns

Configuración  de external dns k8s  

  1. nano externaldns-values.yaml
rbac:
  create: true

provider: aws # tienes que crear la politica de acceso y atacharla al rol

#digitalocean:
#  apiToken: your_api_token

interval: "1m"

policy: sync # or upsert-only

domainFilters: [ 'ncleguizamon.co' ]

2. Deploy  external-dns pod

helm install stable/external-dns --name external-dns -f externaldns-values.yaml

3. nano ingress-nginx.yaml

apiVersion: extensions/v1beta1                                     
kind: Ingress
metadata:
  name: nginx-ingress
spec:
  rules:
  - host: nginx.ncleguizamon.co
    http:
      paths:
      - backend:
          serviceName: nginx #service name
          servicePort: 80

4. nano service-nginx.yaml

apiVersion: v1                                                           
kind: Service
metadata:
  name: nginx
  annotations:
    external-dns.alpha.kubernetes.io/hostname: nginx.ncleguizamon.co
spec:
  type: LoadBalancer
  ports:
  - port: 80
    targetPort: 5678
  selector:
    app: nginx

5. nano deployment-nginx.yaml

apiVersion: apps/v1                                                 
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx

6.


kubectl apply -f .                                                          

Referencia :

How To Automatically Manage DNS Records From DigitalOcean Kubernetes Using ExternalDNS | DigitalOcean
ExternalDNS automatically manages external DNS records from within a Kubernetes cluster. Once deployed, ExternalDNS works in the background and requires almost no additional configuration. Whenever a Service or Ingress is created or changed, ExternalDNS will update the records right away. In this t…
kubernetes-sigs/external-dns
Configure external DNS servers (AWS Route53, Google CloudDNS and others) for Kubernetes Ingresses and Services - kubernetes-sigs/external-dns