Use Kubernetes
This section describes how to install Kroki on Kubernetes using the default
namespace.
On this page you will find how to:
-
Use
Ingress
to expose the service on port 8000. -
Download and extract the example Kroki kubernetes definition files
-
Install the Kubernetes objects as a batch or one by one.
-
Validate the installation
-
Delete the Kroki installation
Providing external access to Kroki
To allow external access to your Kroki internal service,
you publish the service using This example uses Read more about how to publish a service on the Kubernetes documentation website. |
Extract the Kubernetes object definition files
Prepare the Kubernetes definition files by doing the following:
-
Download the example bundle
kroki-k8s-multipod.zip
that contains all the requiredDeployment
,Service
andIngress
definition files to deploy Kroki on Kubernetes.Example command withwget
installedwget http://docs.kroki.io/kroki/setup/_attachments/kroki-k8s-multipod.zip -O kroki-k8s-multipod.zip
-
Extract the contents of the above zip file into a folder named
kroki-k8s
.Example command withunzip
installedunzip kroki-k8s-multipod.zip -d kroki-k8s
In the next steps you use the *.yml
files beneath the directory kroki-k8s
and apply them in batch or individually, to create the Kubernetes objects.
Create objects as a batch
To install (create) all the Kubernetes objects in a batch do the following:
Use the command kubectl apply
to create all the required Kubernetes objects,
replacing /path/to/kroki-k8s with the path to the folder containing the *.yaml
definition files.
kubectl apply -f /path/to/kroki-k8s
Your next step is to Validate that Kroki is running.
Read more about working with kubernetes objects on the Kubernetes website.
Create objects individually
Alternatively they can be applied individually.
To install them individually from GitHub, open a terminal and type commands indicated for each service:
kubectl apply -f example$/k8s/blockdiag-deployment.yaml
kubectl apply -f example$/k8s/blockdiag-service.yaml
kubectl apply -f example$/k8s/mermaid-deployment.yaml
kubectl apply -f example$/k8s/mermaid-service.yaml
kubectl apply -f example$/k8s/bpmn-deployment.yaml
kubectl apply -f example$/k8s/bpmn-service.yaml
kubectl apply -f example$/k8s/excalidraw-deployment.yaml
kubectl apply -f example$/k8s/excalidraw-service.yaml
kubectl apply -f example$/k8s/wireviz-deployment.yaml
kubectl apply -f example$/k8s/wireviz-service.yaml
kubectl apply -f example$/k8s/kroki-deployment.yaml
kubectl apply -f example$/k8s/kroki-service.yaml
kubectl apply -f example$/k8s/kroki-ingress.yaml
Your next step is to Validate that Kroki is running.
Validate that Kroki is running
After installing the Kroki Kubernetes objects you verify that Kroki is running.
To verify that the Kroki service is running do the following:
-
Run the
kubectl get pod
command:kubectl get pod
If the installation is successful a list of running pods is shown that includes the following:
NAME READY STATUS RESTARTS AGE blockdiag-7bd6c989b7-zhvj8 1/1 Running 0 24s bpmn-6cfccf9bc4-6w4px 1/1 Running 0 24s excalidraw-5b84995fcb-dh57t 1/1 Running 0 24s kroki-6b49bcb7c4-x2ksc 1/1 Running 0 23s mermaid-7bff5c9959-hkrxx 1/1 Running 0 22s wireviz-8c778ff7a8-7ds7c 1/1 Running 0 24s
-
To make sure that Kroki is working, open a terminal and type:
kubectl port-forward service/kroki 8000:8000
The above command forwards local port 8000 to port 8000 on the
service/kroki
Pod. In other words, Kroki is accessible on localhost:8000. -
Open a second terminal and type:
curl http://localhost:8000/seqdiag/svg/eNorTi1MyUxMV6jmUlBIKsovL04tUtC1UyhPTQKyyoCc6JzEpNQcBVsFJXfXEAX9zLyU1Aq9jJLcHKVYayQ9Nrq6CE3WhA0L8A8GmpaUk5-un5yfm5uaVwIxD6EWqDElsSQxKbE4FUmfp1-wa1CIAg49IFfANOFxXS0A68hQUg==
If successful, a diagram is shown.
Uninstall Kroki
If you installed Kroki using the downloaded and unpacked *.yaml
files, Kroki can be deleted using those same files.
To uninstall Kroki use the command kubectl delete
as follows:
kubectl delete -f /path/to/kroki-k8s
Using a Single Pod Consisting of Multiple Containers
As a much simpler (but less-flexible) configuration, it is possible to run all containers inside of a single Kubernetes pod.
-
Download the example bundle
kroki-k8s-singlepod.zip
that contains all the requiredDeployment
,Service
andIngress
definition files to deploy Kroki on Kubernetes.Example command withwget
installedwget http://docs.kroki.io/kroki/setup/_attachments/kroki-k8s-singlepod.zip -O kroki-k8s-singlepod.zip
-
Extract the contents of the above zip file into a folder named
kroki-k8s
.Example command withunzip
installedunzip kroki-k8s-singlepod.zip -d kroki-k8s
You can then create the Kubernetes objects as a batch or individually, similar to what was shown previously.
Validation and uninstall/removal of Kubernetes objects can be followed using the exact same commands as shown previously too.