backstage-plugins icon indicating copy to clipboard operation
backstage-plugins copied to clipboard

Kiali backend needs a standalone dev environment

Open tumido opened this issue 2 years ago • 3 comments

We need to provide a standalone dev environment for plugins that interact with backstage catalog so we can eventually remove packages folder and develop plugins independently.

Please take a look at the Kiali backend plugin and implement a catalog backend similar to the implementation for Keycloak plugin https://github.com/janus-idp/backstage-plugins/pull/543

tumido avatar Jul 27 '23 16:07 tumido

While replicating the dev environment locally I thought a good approach here would be to try getting this all running on kind to see if that will be a workable footprint. This approach still may require some kind of setup script and more dependencies than I'd like, but we'll see.

It could also be just as feasible to capture some live data from the actual app and use that to drive a mock backend for the kiali plugin to fetch data from, provided that it's easy enough to add additional use cases in the future.

gashcrumb avatar Sep 01 '23 13:09 gashcrumb

Took a bit but I have an istio with Kiali and the sample app running on kind locally, next steps is to review my list of commands and see how much can be automated. This approach requires kubectl, kind, istioctl and either docker or podman. With this all running the control plane container is using ~6.5gb memory, I've seen worse :smile:

gashcrumb avatar Sep 01 '23 18:09 gashcrumb

These are the steps I used to get Kiali running on kind but I think this is more than what's needed:

Prerequisites: podman, kubectl, kind, istioctl

For podman on Linux follow the rootless setup => https://kind.sigs.k8s.io/docs/user/rootless/

Creating the cluster

cat <<EOF | kind create cluster -n test-cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 8280
    protocol: TCP
  - containerPort: 443
    hostPort: 8443
    protocol: TCP
EOF

Ingress

The above command is half of setting up ingress, the other half is to install a controller, I used nginx for no other reason than I recognize the name:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml

Dashboard

I set up Dashboard but probably shouldn't be required. Anyways, followed the commands in https://istio.io/latest/docs/setup/platform-setup/kind/

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
kubectl create serviceaccount -n kubernetes-dashboard admin-user
kubectl create clusterrolebinding -n kubernetes-dashboard admin-user --clusterrole cluster-admin --serviceaccount=kubernetes-dashboard:admin-user
token=$(kubectl -n kubernetes-dashboard create token admin-user)

To see Dashboard:

kubectl port-forward --address=0.0.0.0 -n kubernetes-dashboard services/kubernetes-dashboard 8001:443

Installing istio

We'll start with doing the installation via istoctl, first it needs to be downloaded:

curl -L https://istio.io/downloadIstio | sh -

This downloads a distribution which then needs to be extracted and then somehow added to the PATH.

istio is then installed onto kind using:

istioctl install --set profile=demo

Then run:

kubectl label namespace default istio-injection=enabled

and then:

kubectl apply -f [samples/bookinfo/platform/kube/bookinfo.yaml](https://raw.githubusercontent.com/istio/istio/release-1.18/samples/bookinfo/platform/kube/bookinfo.yaml)

to install the booking info sample application. Then open it to outside traffic:

kubectl apply -f [samples/bookinfo/networking/bookinfo-gateway.yaml](https://raw.githubusercontent.com/istio/istio/release-1.18/samples/bookinfo/networking/bookinfo-gateway.yaml)

then check for any obvious problems using:

istio analyze

Installing Kiali

kubectl apply -f samples/addons
kubectl rollout status deployment/kiali -n istio-system

Finally we can then expose the kiali dashboard:

kubectl port-forward --address=0.0.0.0 -n istio-system svc/kiali 1337:20001

And access http://some-host:1337/ to see the kiali UI.

I feel though that it might be better to understand what data the Kiali plugin specifically needs and instead create a mock backend that serves this data and provides a landing spot for the external link that the Kiali plugin has to get the user to the full Kiali experience. Granted there's a bit extra in the above steps, but it's at the smallest kind + istio + prometheus + kiali and some example app to get actual data that the plugin would show.

gashcrumb avatar Sep 26 '23 19:09 gashcrumb

This issue has been closed due to the fact that the Janus community is being sunset.

For future plugin issues, please use https://github.com/backstage/community-plugins/issues

For future showcase issues, please use https://issues.redhat.com/browse/RHIDP

For more information on the sunset, see:

https://janus-idp.io/blog/2024/07/05/future-of-janus-community https://issues.redhat.com/browse/RHIDP-3690 https://issues.redhat.com/browse/RHIDP-1018

rhdh-bot avatar Sep 03 '24 17:09 rhdh-bot