Custom domains

This article describes how you can use your own domains with Bunnyshell.

πŸ“˜

The recommended solution is to use the popular open-source solution ExternalDNS to handle the actual DNS records creation and removal.


Use your own domain in bunnyshell.yaml

The first step is to instruct Bunnyshell to allow using your own domain when creating hosts (which translates to creating Ingresses). You just need to specify the selfManagedDns attribute with the true value under the host.

A simple example is provided below:

components:
    -
        kind: Service
        name: nginx
        dockerCompose:
            image: 'nginx:latest'
            ports:
                - '80:80'
        hosts:
            -
                hostname: '*.myowndomain.com'
                path: /
                servicePort: 80
                selfManagedDns: true

This way, Bunnyshell will not create the DNS record for the hostname, but leave the DNS creation to a 3rd party - ExternalDNS in this case.


Installing ExternalDNS in your cluster

In order to complete the setup and also have the actual DNS records created, you need ExternalDNS installed in your Kubernetes cluster and configured/integrated with your DNS provider.

The list of available DNS providers is available on ExternalDNS's Github repository.

Install ExternalDNS for CloudFlare

You can use a Helm Chart provided by Bitnami to easily install ExternalDNS.

helm upgrade --install external-dns-bunnyshell \
  --create-namespace \
  --namespace=external-dns \
  --set "sources[0]"=ingress \
  --set provider=cloudflare \
  --set policy=sync \
  --set cloudflare.apiToken=Z9-n1s**********************WwM-gVoRiYnk \
  --set cloudflare.proxied=true \
  --set txtOwnerId=k8s-aws-se-cluster \
  --set "domainFilters[0]"=bunnydemo.com \
  oci://registry-1.docker.io/bitnamicharts/external-dns

You just need to:

  • replace cloudflare.apiToken
  • set the txtOwnerId to your cluster's name
  • set domainFilters[0] to your actual domain

For the full list of parameters supported by the Helm Chart, consult its documentation.


πŸ“˜

Bunnyshell will integrate ExternalDNS as a cluster add-on in the upcoming period.