import subprocess def install_graphviz(): subprocess.check_call("apt-get install graphviz -y", shell=True) subprocess.check_call("pip install graphviz", shell=True) subprocess.check_call("pip install pygraphviz", shell=True) if __name__ == '__main__': install_graphviz() from diagrams import Diagram from diagrams.k8s.clusterconfig import HPA from diagrams.k8s.compute import Deployment, Pod, ReplicaSet from diagrams.k8s.network import Ingress, Service with Diagram("Exposed Pod with 3 Replicas", show=False): net = Ingress("domain.com") >> Service("svc") net >> [Pod("pod1"), Pod("pod2"), Pod("pod3")] << ReplicaSet("rs") << Deployment("dp") << HPA("hpa")