One of the first questions I ask about a new technology is can I make it play with graphviz or Neo4j
The second trick is to see if someone else has already solved it.
This time both are true:
https://github.com/steveteuber/kubectl-graph
This is a library that can export k8s setups to either graphviz or to neo4j.