Skip to content

kiali/kiali

KialiTweet about Kiali

Apache 2.0 license

Introduction

kialiis a management console for Istio service mesh. Kiali can be quickly installed as an Istio add-on, or trusted as a part of your production environment.

Contributing

First, check theCommunity section on kiali.io,which provides a brief introduction on contributing, how to report issues and request features, and how to reach us.

If you would like to make code contributions, please also check theContribution Guide.

Getting Started

The target audience of this README are developers. If you are not a developer but want to learn more about Kiali, theKiali documentationshould be more helpful. For instructions on installing Kiali, please read theInstallationpage.

How and where Kiali is released?

Read theRELEASING.adocfile.

Developer setup

Make sure you have the following tools:

  • TheGo Programming Language

    • Currently, Kiali releases are built using a specific minimum version of Go as declared in theMakefile.Although Kiali may build correctly using other versions of Go, it’s suggested to use the version that the Makefile uses for your own development to ensure replicatable builds.

  • git

  • gcc

  • DockerorPodman

    • If you are usingpodmandeclare the environment variableDORP=podman.

  • NodeJS(Node.js >= 18 with the NPM command)

  • Yarn

  • TheGNU makeutility or any of it’s alternatives

Once you have the required developer tools, you can get and build the code with the following script:

#Checkout the source code
mkdir kiali_sources
cdkiali_sources
exportKIALI_SOURCES=$(pwd)

git clone https://github /kiali/kiali.git
git clone https://github /kiali/kiali-operator.git
git clone https://github /kiali/helm-charts.git

ln -s$KIALI_SOURCES/kiali-operator kiali/operator

#Build the back-end and run the tests
cd$KIALI_SOURCES/kiali
make buildtest

#You can pass go test flags through the GO_TEST_FLAGS env var
#make -e GO_TEST_FLAGS= "-race -v -run=\" TestCanConnectToIstiodReachable\ "" test

#Build the front-end and run the tests
make build-ui-test
Note
The rest of this README assumes the directory tree created by the previous commands:
-- kiali_sources
|- kiali
|- kiali-operator
\- helm-charts

Create a Kubernetes cluster and install a Service Mesh

Since Kiali is a management console for an Istio-based service mesh, you will need an Istio-like Service Mesh to try Kiali. Then, Istio Meshes are installed on Kubernetes clusters.

We provide a few unsupported scripts that can help to get started:

  • You can use thecrc-openshift.shscript to create an OpenShift cluster on your local machine.

  • If you are familiar to minikube, you may try thek8s-minikube.shscript. It has the option to install Dex which is useful if you want to test with OpenID.

  • You can also usekind,runstart-kind.shscript to create a single node KinD cluster with metallb enabled for testing Kiali against a real environment.

  • Finally, theinstall-istio-via-istioctl.shand theinstall-bookinfo-demo.shscripts can assist into installing Istio and the Bookinfo sample application in your cluster, respectively. You can try running these scripts without any arguments.

These scripts are written to rely on the minimum dependencies as possible and will try to download any required tools.

Depending on the type of cluster you are using, you should define theCLUSTER_TYPEenvironment variable on your shell toopenshift(this is the default if not set),minikubeorkindvalue so that the Makefiles can assist in other operations. If you are not using any of these clusters, you should set the environment variable toCLUSTER_TYPE=local.

Note
If you are usingminikubeit’s recommended that you enable theregistryandingressadd-on. Thek8s-minikube.shscript should do this for you.
Note
If you are usingdockerand using minikube’s registry add-on or any custom non-secure registry, make sure theDocker daemon is properly configured to use your registry.

Building the Container Image and deploying to a cluster

Assuming that:

  • you have successfully built the back-end and the front-end,

  • you also have created a Kubernetes cluster with an Istio-based Service Mesh installed on it,

  • and you are not using theCLUSTER_TYPE=localenvironment variable

the following commands should deploy a development build of Kiali to the cluster:

cd$KIALI_SOURCES/kiali

#Build the Kiali-server and Kiali-operator container images and push them to the cluster
make cluster-push

#If you want to only build and push the Kiali-server container images:
#make cluster-push-kiali

#If you want to only build and push the Kiali-operator container images:
#make cluster-push-operator

#Deploy the operator to the cluster
make operator-create

#Create a KialCR to instruct the operator to deploy Kiali
make kiali-create

If you are using theCLUSTER_TYPE=localenvironment variable, you will need to declare some additional environment variables to set the container registry where container images should be pushed and usemake container-push*targets instead ofcluster-push*targets. For example, if your container registry islocalhost:5000:

exportQUAY_NAME=localhost:5000/kiali/kiali
exportCONTAINER_NAME=localhost:5000/kiali/kiali
exportOPERATOR_QUAY_NAME=localhost:5000/kiali/kiali-operator
exportOPERATOR_CONTAINER_NAME=localhost:5000/kiali/kiali-operator

cd$KIALI_SOURCES/kiali

#Build the Kiali-server and Kiali-operator container images and push them to the cluster
make container-build container-push

#If you want to only build and push the Kiali-server container images:
#make container-build-kiali container-push-kiali-quay

#If you want to only build and push the Kiali-operator container images:
#make container-build-operator container-push-operator-quay

#Deploy the operator to the cluster
make operator-create

#Create a KialCR to instruct the operator to deploy Kiali
make kiali-create

Reloading Kiali image

If you already have Kiali installed and you want to recreate the kiali server pod, you can run the following command:

cd$KIALI_SOURCES/kiali
make kiali-reload-image

This is to facilitate development. To quickly build a new Kiali container image and load it to the cluster, you can run:

cd$KIALI_SOURCES/kiali/frontend
yarn&&yarn build

cd$KIALI_SOURCES/kiali
make clean build cluster-push-kiali kiali-reload-image
Note
There is no equivalent reload command for the operator. You would need to manually reload the operator viakubectloroccommands.

Cluster clean-up

cd$KIALI_SOURCES/kiali

#Delete the Kiali CR to let the operator remove Kiali.
make kiali-delete

#If the previous command never ends, the following command forces removal by bypassing the operator
#make kiali-purge

#Remove the operator
#NOTE: After this completes, the `kiali-create` and `kiali-delete` targets will be ineffective
#until you run the `operator-create` target to re-deploy the Kiali operator again.
make operator-delete

Code formatting and linting

If you are changing the back-end code of Kiali, before submitting a pull request make sure your changes are properly formatted and no new linting issues are introduced by running:

#CD to the back-end source code
cd$KIALI_SOURCES/kiali

#Install linting tools
make lint-install

#Format the code and run linters
make format lint

Enable tracing

Kiali itself is instrumented with opentelemetry tracing to help provide insights and surface performance issues for the kiali server. To enable, set theserver.observability.tracing.enabledandserver.observability.tracing.collector_urlconfiguration options.

apiVersion:kiali.io/v1 Alpha 1
kind:Kiali
metadata:
name:kiali
spec:
...
server:
observability:
tracing:
collector_url:http://jaeger-collector.istio-system:14268/api/traces
enabled:true
...

Running Standalone

You may want to run Kiali outside of any cluster environment for debugging purposes. To do this, you will want to use therun-kiali.sh hack scriptlocated in the hack directory.See the--helpoutput for the options you can set. The default configuration it uses is found in theconfig template file also located in thehackdirectory. Read the comments at the tops of both files for more details.

cd$KIALI_SOURCES/kiali/hack
./run-kiali.sh

Running integration tests

There are two sets of integration tests. The first are backend tests that test the Kiali API directly. These can be found atbackend tests.The second are frontend Cypress tests that test Kiali through the browser. These can be found atfrontend tests.

Both tests are run as part of the CI pipeline. If you’d like to run these same tests locally, you can usethis scriptto setup your local environment and run the integration tests. Or these tests can be run against any live environment that meets the following requirements.

Requirements: - Istio - Kiali - bookinfo demo app - error rates demo app

You can usethis scriptto install all the neccessary demo apps for testing. The script supports both openshift and non-openshift deployments.

#If you are doing frontend development, start the frontend development server, where `<kiali-url>` is the URL to the base Kiali UI location such as `http://localhost:20001/kiali`:
make -e YARN_START_URL=http://<kiali-url>yarn-start

#Start the cypress tests. The tests will run against the frontend development server by default.
#Otherwise you can pass a custom url with env vars:
#
#make -e CYPRESS_BASE_URL=http://<kiali-url> cypress-gui
make cypress-gui

Note thatmake cypress-guiruns the Cypress GUI that allows you to pick which individual tests to run. To run the entire test suite in headless mode, use the make targetcypress-runinstead.

Debugging Server Backend

VisualStudio Code

If you are using VisualStudio Code, you can install the followinglauncher.jsonthat is then used to launch the Kiali Server in the debugger. Run thehack/run-kiali.shscript first to ensure the proper services are up (such as the Prometheus port-forward proxy).

{
// To use this, first run "hack/run-kiali.sh --tmp-root-dir $HOME/tmp --enable-server false"
// Pass in --help to that hack script for details on more options.
"version":"0.2.0",
"configurations":[
{
"name":"Launch Kiali to use hack script services",
"type":"go",
"request":"launch",
"mode":"debug",
"program":"${workspaceRoot}/kiali.go",
"cwd":"${env:HOME}/tmp/run-kiali",
"args":["-config","${env:HOME}/tmp/run-kiali/run-kiali-config.yaml"],
"env":{
"KUBERNETES_SERVICE_HOST":"127.0.0.1",
"KUBERNETES_SERVICE_PORT":"8001",
"LOG_LEVEL":"trace"
}
}
]
}

Debugging GUI Frontend

You can debug the Kiali GUI directly inside of Google Chrome using the Chrome Developer Tools or using VisualStudio Code.

In order to use either one, you first must perform some initial steps.

First, run the Kiali Server backend, either normally within a cluster or viarun-kiali.shas explained earlier. Determine what the Kiali URL is before moving to the next step. For example, if you run Kiali in minikube, and you set up a port-forward that exposes it, the URL to remember will behttp://localhost:20001/kiali.

Second, run the GUI frontend using make:make -e YARN_START_URL=<kiali-url> yarn-startwhere<kiali-url>is the URL you determined from the previous step. You may need to also pass-e PORT=3001to override the default port where the yarn server will listen to (the default is3000which will conflict with Grafana if you started the Kiali Server viarun-kiali.sh). Some examples:

  • If the Kiali Server is running in minikube with a port-forward exposing it, then runmake -e YARN_START_URL=http://localhost:20001/kiali yarn-start.

  • If the Kiali Server is running in OpenShift with the usual Kiali Route exposing it, then runmake -e YARN_START_URL=https://<Kiali-OpenShift-Route-IP>/ yarn-start.

  • If the Kiali Server is running locally viarun-kiali.sh,then runmake -e YARN_START_URL=http://localhost:20001/kiali -e PORT=3001 yarn-start.

Theyarn-startmake command will start the Kiali GUI frontend on a local endpoint - when it is ready, look at the output for the "Local" URL you use to access it. The output will look something like this:

Compiled successfully!

You can now view @kiali/kiali-ui in the browser.

Local: http://localhost:3001
On Your Network: http://192.168.1.15:3001
...

At this point, you can begin to set up your debugger tool of choice - see the next sections.

Google Chrome Developer Tools

Start Google Chrome and point the browser to the local URL for the Kiali GUI frontend started by yarn-start (in the example above, that will behttp://localhost:3001).

In Google Chrome, open the Developer Tools. You can pressF12orControl-Shift-Ito do this.

Within the Developer Tools, navigate to theSourcestab, then theFilesystemsub-tab, and press the+ Add folder to workspacelink. In the file selection dialog, select your Kialifrontend/srcfolder. This will inform Developer Tools where your Kiali GUI frontend source code can be found.

At this point, you need to give Google Chrome permission to access your local source code folder. Towards the top of the browser window, you will see a prompt - press the "Allow" button to give Chrome the necessary permissions it needs.

You are now ready to debug the Kiali Server frontend. You can set breakpoints, inspect variables, examine stack traces, etc. just as you can do with any typical debugging tool.

VisualStudio Code

If you are using VisualStudio Code, you can install the followinglauncher.jsonthat is then used to launch Google Chrome to debug the Kiali Server GUI frontend in the debugger. Theurlsetting is the local URL of the yarn-start server - make sure you use the one appropriate for your environment.

{
"version":"0.2.0",
"configurations":[
{
"name":"Launch Chrome",
"type":"chrome",
"request":"launch",
"url":"http://localhost:3001",
"webRoot":"${workspaceFolder}"
}
]
}

Configuration

Many configuration settings can optionally be set within the Kiali Operator custom resource (CR) file. Seethis example Kiali CR filethat has all the configuration settings documented.

Embedding Kiali

If you want to embed Kiali in other applications, Kiali offers a simple feature calledKiosk mode.In this mode, Kiali won’t show the main header, nor the main navigation bar.

To enable Kiosk mode, you only need to add akiosk=<platform_id>URL parameter. You will need to use the full path of the page you want to embed. For example, assuming that you access Kiali through HTTPS:

  • To embed theOverviewpage, usehttps://kiali_path/overview?kiosk=console.

  • To embed theGraphpage, usehttps://kiali_path/graph/namespaces?kiosk=console.

  • To embed theApplications listpage, usehttps://kiali_path/applications?kiosk=console.

If the page you want to embed uses other URL arguments, you can specify any of them to preset options. For example, if you want to embed the graph of thebookinfonamespace, use the following URL:http://kiali_path/graph/namespaces?namespaces=bookinfo&kiosk=console.

<platform_id>value in thekioskURL parameter will be used in future use cases to add conditional logic on embedded use cases, for now, any non empty value will enable the kiosk mode.

Configure External Services

Grafana

If you have Grafana installed in a custom way that is not easily auto-detectable by Kiali, you need to change in the Kiali CR the value of the grafana > url

apiVersion:kiali.io/v1 Alpha 1
kind:Kiali
metadata:
name:kiali
spec:
...
external_services:
grafana:
url:http://grafana-istio-system.127.0.0.1.nip.io
...

Additional Notes

Frontend development guidelines

Frontend development guidelines (styles, i18n, etc.) can be foundhere

Upgrading Go

The Kiali project will periodically upgrade to a newer version of Go. These are the steps that need to be performed in order for the Kiali build to use a different version of Go:

  1. Rungo mod edit -go=x.ywhere "x" and "y" are the major/minor versions of the Go version being used.

  2. Rungo mod tidy -v

  3. Runmake clean build build-ui testto ensure everything builds correctly. If any problems occur, obviously you must fix them.

  4. Commit the changes to your working branch, create a PR, and make sure everything builds and works before merging the PR.

The Makefile and some Github Actions will check the go version from the go.mod file.

Procedure to check and update patternfly versions

  1. Launch commandnpx npm-check-updates -t latest -f '/^@patternfly/'

  2. Launchyarn installto update the yarn.lock

  3. Add to the commit package.json and yarn.lock

Running the UI outside the cluster

When developing theKiali UIyou will find it useful to run it outside of the cluster to make it easier to update the UI code and see the changes without having to re-deploy. The preferred approach for this is to use theproxyfeature of React. The process is describedhere.Alternatively, you can use themake -e YARN_START_URL=<url> yarn-startcommand where<url>is to the Kiali backend.

Disabling SSL

In the provided OpenShift templates, SSL is turned on by default. If you want to turn it off, you should:

  • Remove the "tls: termination: reencrypt" option from the Kiali route

  • Remove the "identity" block, with certificate paths, from the Kiali Config Map.

  • Optionally you can also remove the annotation "service.beta.openshift.io/serving-cert-secret-name" in the Kiali Service, and the relatedkiali-cabundlevolume that is declared and mounted in Kiali Deployment (but if you don’t, they will just be ignored).

Exposing Kiali to External Clients Using Istio Gateway

The operator will create a Route or Ingress by default (see the Kiali CR setting "deployment.ingress_enabled" ). If you want to expose Kiali via Istio itself, you can create Gateway, Virtual Service, and Destination Rule resources similar to below:

---
apiVersion:networking.istio.io/v1
kind:Gateway
metadata:
name:kiali-gateway
namespace:istio-system
spec:
selector:
istio:ingressgateway
servers:
-port:
number:80
name:http-kiali
protocol:HTTP
#https://istio.io/latest/docs/reference/config/networking/gateway/#ServerTLSSettings
tls:
httpsRedirect:false
hosts:[<your-host>]
-port:
number:443
name:https-kiali
protocol:HTTPS
tls:{}
hosts:[<your-host>]
...
---
apiVersion:networking.istio.io/v1
kind:VirtualService
metadata:
name:kiali-virtualservice
namespace:istio-system
spec:
gateways:
-kiali-gateway
hosts:[<your-host>]
http:
-route:
-destination:
host:kiali.istio-system.svc.cluster.local
port:
number:20001
weight:100
...
---
apiVersion:networking.istio.io/v1
kind:DestinationRule
metadata:
name:kiali-destinationrule
namespace:istio-system
spec:
host:kiali
trafficPolicy:
tls:
mode:DISABLE
...

Experimental

Observing a Remote Cluster

Note
The "Central IstioD" setup is currently named "Primary-remote" multi-cluster setup.
Warning
When this support was incorporated into Kiali, the "Central IstioD" setup of Istio was in an early development phase. These instructions are probably now broken.

There are certain use cases where Kiali needs to be deployed in one cluster (Control Plane) and observe a different cluster (Data Plane). Diagram

Follow these steps:

1: You should have theIstio with an External Control Planesetup running

2: Create theKiali ClusterRole, ClusterRoleBinding, and ServiceAccountin the Data Plane cluster

3: Create a remote secret in the Control Plane, using the Data Plane ServiceAccount you just created. This allows the Control Plane to read from and modify the Data Plane

istioctl create-remote-secret --service-account kiali-service-account --context=$DataPlane--name kiali|kubectl apply -n istio-system --context=$ControlPlane-f -

4: You will now run Kiali in the Control Plane. You need to add the remote secret to the Kiali Deployment by specifying a Volume and VolumeMount. When Kiali sees/kiali-remote-secret/kialiit will use the remote cluster’s API server instead of the local API server

spec:
template:
spec:
containers:
-volumeMounts:
-mountPath:/kiali-remote-secret
name:kiali-remote-secret
volumes:
-name:kiali-remote-secret
secret:
defaultMode:420
optional:true
secretName:istio-remote-secret-kiali

5: Kiali now needs the Istio metrics from the sidecars. You need to run Prometheus in the Control Plane and have it scrape the metrics from anenvoyMetricsService.Thesemetricsarerequired.

6: Kiali in the Control Plane should now be fully functional with the Data Plane