Skip to main content

No project description provided

Project description

k8smap

k8smap is a tool to generate a diagram a diagram text file from kubernetes resource descriptions. I implemented this to get a faster understanding of the resources in a given helm chart. Also it helps me document the infrastructure automatically visually for my colleagues.

Quick start

poetry add k8smap

k8smap -i filename.yaml

Example

You can clone the repo and test it locally.

helm template example > example.yaml 
poetry run k8smap -i infratest.yaml

This will generate the following output to file file output.d2:

Service_pawn:pawn {
  icon: https://raw.githubusercontent.com/kubernetes/community/master/icons/svg/resources/labeled/svc.svg
  shape: image
}
Service_bishop:bishop {
  icon: https://raw.githubusercontent.com/kubernetes/community/master/icons/svg/resources/labeled/svc.svg
  shape: image
}
Pod_bishop-nginx:bishop-nginx {
  icon: https://raw.githubusercontent.com/kubernetes/community/master/icons/svg/resources/labeled/pod.svg
  shape: image
}
Deployment_nginx-deployment:nginx-deployment {
  icon: https://raw.githubusercontent.com/kubernetes/community/master/icons/svg/resources/labeled/deploy.svg
  shape: image
}
Pod_nginx-deployment:nginx-deployment {
  icon: https://raw.githubusercontent.com/kubernetes/community/master/icons/svg/resources/labeled/pod.svg
  shape: image
}
Ingress_pawn-ingress:pawn-ingress {
  icon: https://raw.githubusercontent.com/kubernetes/community/master/icons/svg/resources/labeled/ing.svg
  shape: image
}
Ingress_bishop-ingress:bishop-ingress {
  icon: https://raw.githubusercontent.com/kubernetes/community/master/icons/svg/resources/labeled/ing.svg
  shape: image
}
Service_pawn --> Pod_nginx-deployment
Service_bishop --> Pod_bishop-nginx
Deployment_nginx-deployment --> Pod_nginx-deployment
Ingress_pawn-ingress --> Service_pawn
Ingress_bishop-ingress --> Service_bishop

To generate an image for this graph you can run d2.

d2 output.d2 out.svg

Visualization of the helm chart

Or generate a mermaid flowchart.

mapk8s -i filename.yaml -f mermaid

Components

So far the following components are implemented:

  • Pod
  • Deployment
  • Ingress
  • Service
  • Config Map
  • Service Account
  • Network Policy
  • Cron Job
  • Job
  • Secret
  • Volume
  • Persistent Volume
  • Persistent Volume Claim

Output formats

So far the following output languages are supported:

Use the -f [d2, mermaid] flag to specify the format.

License

This is unclear right now and needs to be checked. As I am using in this code svg from Kubernetes, I first have to evaluate what license I can use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

k8smap-0.1.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k8smap-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file k8smap-0.1.1.tar.gz.

File metadata

  • Download URL: k8smap-0.1.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.7 Darwin/22.1.0

File hashes

Hashes for k8smap-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0d815585ae32354592418de1245436058108bc57391bec92bb7c673e493d4b25
MD5 53db5eaa6d70a5a348c63416dc1c16b8
BLAKE2b-256 81d7838d3b0d6d6be25969a3dff4724543195d7f0a1411dc6773cef8158f0a0f

See more details on using hashes here.

File details

Details for the file k8smap-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: k8smap-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.7 Darwin/22.1.0

File hashes

Hashes for k8smap-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed1380b34d00513b1c7979e758ac09e87005d6ea91217bede3f2b66a6eb18911
MD5 695d82bd10db855e40acc995389c4737
BLAKE2b-256 cc0d1c350d291fe2bbe69a43d23c7e0377c8d97d9ef86e49339c80fa7480ee45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page