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
  • Service Account
  • Network Policy
  • Cron Job
  • Job
  • Config Map
  • 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.0.tar.gz (4.8 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.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: k8smap-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 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.0.tar.gz
Algorithm Hash digest
SHA256 07613ca40e6b7f02d6188846c0659ebccb9dfeb7fce1c75157d4c7a011b50e06
MD5 9fcfa76845175ab35c3cdffb3e5ba130
BLAKE2b-256 d933b22335dc8a8f124da2994365fb86d4511aae3293bb9ba0720947a65d35ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: k8smap-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4397b7415383de2491863e6ddc1c91558b1825a8b50cdd56ee2b5f6ab36625df
MD5 0c979fbfc6fc498a5a0cc400f6359836
BLAKE2b-256 c5e000b63ed1a79aa627884a7989f56f8931ff5b4a90a59586c121b07cac2905

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