Create diagrams from the Kubernetes API with go-diagrams.

Overview

Kubernetes diagrams

k8s-diagrams creates diagrams from your kubernetes clusters.

You just have to provide a namespace (or not), and you get a picture from the current state of your cluster. For now it only suppports namespaces, deployments, replicaSets, daemonSets, statefulSets, pods, services and ingresses. I may add other k8s API objects in the future...

How do I build it?

$ make build

Usage

$ ./k8s-diagrams --help                                                                                           ✔ 
NAME:
   k8s-diagrams - Create diagram from the Kubernetes API.

USAGE:
   k8s-diagrams [global options] command [command options] [arguments...]

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --namespace value, -n value        The namespace we want to draw. (default: "default") [$KUBECTL_NAMESPACE]
   --kubeconfig value, -c value       The path to your kube config file. [$KUBECONFIG]
   --outputFilename value, -o value   The output filename. (default: "k8s")
   --outputDirectory value, -d value  The output directory. (default: "diagrams")
   --label value, -l value            The diagram label. (default: "Kubernetes")
   --help, -h                         show help (default: false)

Usage example

$ ./k8s-diagrams -n mynamespace -d diagrams -o k8s
$ cd diagrams
$ dot -Tpng k8s.dot > k8s.png

Render example

Small namespace

Diagram

Big namespace

Big diagram

You might also like...
A k8s vault webhook is a Kubernetes webhook that can inject secrets into Kubernetes resources by connecting to multiple secret managers
A k8s vault webhook is a Kubernetes webhook that can inject secrets into Kubernetes resources by connecting to multiple secret managers

k8s-vault-webhook is a Kubernetes admission webhook which listen for the events related to Kubernetes resources for injecting secret directly from sec

Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes.
Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes.

Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes. This project is inspired by agones. Introduction Genera

Kubei is a flexible Kubernetes runtime scanner, scanning images of worker and Kubernetes nodes providing accurate vulnerabilities assessment, for more information checkout:
Kubei is a flexible Kubernetes runtime scanner, scanning images of worker and Kubernetes nodes providing accurate vulnerabilities assessment, for more information checkout:

Kubei is a vulnerabilities scanning and CIS Docker benchmark tool that allows users to get an accurate and immediate risk assessment of their kubernet

The OCI Service Operator for Kubernetes (OSOK) makes it easy to connect and manage OCI services from a cloud native application running in a Kubernetes environment.

OCI Service Operator for Kubernetes Introduction The OCI Service Operator for Kubernetes (OSOK) makes it easy to create, manage, and connect to Oracle

Kubernetes IN Docker - local clusters for testing Kubernetes
Kubernetes IN Docker - local clusters for testing Kubernetes

kind is a tool for running local Kubernetes clusters using Docker container "nodes".

An Easy to use Go framework for Kubernetes based on kubernetes/client-go

k8devel An Easy to use Go framework for Kubernetes based on kubernetes/client-go, see examples dir for a quick start. How to test it ? Download the mo

provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters

provider-kubernetes provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters ty

Kubernetes Operator to sync secrets between different secret backends and Kubernetes

Vals-Operator Here at Digitalis we love vals, it's a tool we use daily to keep secrets stored securely. We also use secrets-manager on the Kubernetes

Crossplane provider to provision and manage Kubernetes objects on (remote) Kubernetes clusters.

provider-kubernetes provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters ty

Comments
  • Connect with k8s clusters that based their auth on OIDC

    Connect with k8s clusters that based their auth on OIDC

    First of all, thanks for this promising project; So, I'm just trying to connect with one of my kubernetes clusters and I had this error:

    2021/04/27 22:39:25 creating kubernetes client: no Auth Provider found for name "oidc"
    

    The cluster is an IKS on IBMCloud and the auth of the kubeconfig is based on some tokens and the IBMCloud auth system

    apiVersion: v1
    clusters:
    - cluster:
        certificate-authority: /Users/foo/.bluemix/plugins/container-service/clusters/apis-dev-bq1q5dvd0s7sa54sdtlg/ca-aaa00-apis-dev.pem
        server: https://c2.us-south.containers.cloud.ibm.com:24441
      name: apis-dev/bq1q5dvd0s7sa54sdtlg
    contexts:
    - context:
        cluster: apis-dev/bq1q5dvd0s7sa54sdtlg
        namespace: default
        user: [email protected]/[REDACTED]/iam.cloud.ibm.com-identity
      name: apis-dev/bq1q5dvd0s7sa54sdtlg
    current-context: apis-dev/bq1q5dvd0s7sa54sdtlg
    kind: Config
    preferences: {}
    users:
    - name: [email protected]/[REDACTED]/iam.cloud.ibm.com-identity
      user:
        auth-provider:
          config:
            client-id: kube
            client-secret: kube
            id-token: [REDACTED]
            idp-issuer-url: https://iam.cloud.ibm.com/identity
            refresh-token: [REDACTED]
          name: oidc
    

    Unfortunately, I'm not able to make a pull request to solve the issue because golang is not my speciallity, but I saw this issue in the k8s go-client project, it could be helpful...I hope.

    thanks!

    enhancement 
    opened by jjuarez 23
  • pod name are overlapping

    pod name are overlapping

    image

    Perhaps the pod name can be shorten as the rs contains the beginning of the name

    For example with: ms-ext-resources-web-5bdd575f7d ms-ext-resources-web-5bdd575f7d-4hf5d

    ms-ext-resources-web-5bdd575f7d ms-.ext..-4hf5d

    enhancement 
    opened by utix 2
Releases(v0.0.6)
Owner
Pierre Erraud
Pierre Erraud
cluster-api-state-metrics (CASM) is a service that listens to the Kubernetes API server and generates metrics about the state of custom resource objects related of Kubernetes Cluster API.

Overview cluster-api-state-metrics (CASM) is a service that listens to the Kubernetes API server and generates metrics about the state of custom resou

Daimler Group 61 Oct 27, 2022
vcluster - Create fully functional virtual Kubernetes clusters - Each cluster runs inside a Kubernetes namespace and can be started within seconds

Website • Quickstart • Documentation • Blog • Twitter • Slack vcluster - Virtual Clusters For Kubernetes Lightweight & Low-Overhead - Based on k3s, bu

Loft Labs 2.3k Jan 4, 2023
PolarDB-X Operator is a Kubernetes extension that aims to create and manage PolarDB-X cluster on Kubernetes.

GalaxyKube -- PolarDB-X Operator PolarDB-X Operator is a Kubernetes extension that aims to create and manage PolarDB-X cluster on Kubernetes. It follo

null 64 Dec 19, 2022
Kubegres is a Kubernetes operator allowing to create a cluster of PostgreSql instances and manage databases replication, failover and backup.

Kubegres is a Kubernetes operator allowing to deploy a cluster of PostgreSql pods with data replication enabled out-of-the box. It brings simplicity w

Reactive Tech Ltd 1.1k Dec 30, 2022
Go framework to create Kubernetes mutating and validating webhooks

kubewebhook Kubewebhook is a small Go framework to create external admission webhooks for Kubernetes. With Kubewebhook you can make validating and mut

Xabier Larrakoetxea Gallego 507 Jan 4, 2023
Kubernetes create pod cli with golang

kubernatestest- Anand #Added more coments Anand2 and K8s #GO COMMANDS to RUN : go run xxx.go to install : go install xyz.go - this created binary file

null 1 Dec 2, 2021
A CoreDNS plugin to create records for Kubernetes nodes.

kubenodes Name kubenodes - creates records for Kubernetes nodes. Description kubenodes watches the Kubernetes API and synthesizes A, AAAA, and PTR rec

InfobloxOpen 7 Jul 7, 2022
Litmus helps Kubernetes SREs and developers practice chaos engineering in a Kubernetes native way.

Litmus Cloud-Native Chaos Engineering Read this in other languages. ???? ???? ???? ???? Overview Litmus is a toolset to do cloud-native chaos engineer

Litmus Chaos 3.4k Jan 1, 2023
KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes

Kubernetes-based Event Driven Autoscaling KEDA allows for fine-grained autoscaling (including to/from zero) for event driven Kubernetes workloads. KED

KEDA 5.9k Jan 7, 2023
network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of kubernetes.

Network Node Manager network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of ku

kakao 102 Dec 18, 2022