hardillb / k8s-ingress-to-avahi

Generates mDNS CNAME entries for K8s Ingress Host Names

Home Page:https://www.hardill.me.uk/wordpress/2020/12/28/setting-up-mdns-cname-entris-for-k8s-ingress-hostnames/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

k8s-ingress-to-avahi

A quick and dirty hack to turn Ingress hostnames into mDNS CNAME entries

Install

$ git clone https://github.com/hardillb/k8s-ingress-to-avahi.git
$ cd k8s-ingress-to-avahi
$ npm install

Running

This runs on the Ingress Host machine outside of Kubernetes (might be able to get it to work in a container, but will need the DBUS socket mounting into the container)

The script take 3 arguments

  • The path to the kubctl config file
  • The mDNS hostname of the Ingress machine
  • Optional namespace to watch (uses default if not present)

e.g.

$ node index.js /home/ubuntu/.kube/config ubuntu.local

or

$ node index.js /home/ubuntu/.kube/config ubuntu.local foo

The Ingress YAML should look something like this:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: manager-ingress
spec:
  rules:
  - host: "manager.ubuntu.local"
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: manager
            port:
              number: 3000 

No HTTPS support

Might add this later, but it would require custom Certificate Authority to issue certs for .local domain.

About

Generates mDNS CNAME entries for K8s Ingress Host Names

https://www.hardill.me.uk/wordpress/2020/12/28/setting-up-mdns-cname-entris-for-k8s-ingress-hostnames/

License:Apache License 2.0


Languages

Language:JavaScript 100.0%