All about Istio (Service Mesh) : Part 1
Check out this blog as a pre-requisite
Visualize service mesh with KIALI
KIALI is used for observing connections and micro services of istio service mesh, defining and validating them. It visualizes the service mesh topology and provides visibility into fearures like request routing, circuit breakers, request rates, latency etc. It also provides wizards to apply common traffic patterns and automatically generates istio configuration.
Install Kiali to visualize service mesh
from your istio-<version folder> apply this code
Note: Follow this instruction to install istio-<version> folder
kubectl apply -f samples/addons
KIALI will also get installed as an addon
You may see something like this in the outputserviceaccount/kiali createdconfigmap/kiali
created
clusterrole.rbac.authorization.k8s.io/kiali
created
clusterrolebinding.rbac.authorization.k8s.io/kiali
created
service/kiali createddeployment.apps/kiali created
Check if the kiali deployment is running on istio-system namespace
kubectl rollout status deployment/kiali -n istio-system kubectl -n istio-system get svc kiali
Then run the KIALI daskboard
istioctl dashboard kiali
We can check updates for last 1 hour or else. We can set the time, we can set when it should refresh. We can also see all applications running on the istio-system namespace
From mesh, we can see
Let’s add some applications and test kiali. For that, we have already got some samples
Follow this one to create your folder and find them. Once done, enable istio-injection on the default namespace
kubectl label namespace default istio-injection=enabled
Then install files from samples/bookinfo/platform/kube/bookinfo.yaml
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
now it looks something like this
We can now check that istioctl is working fine in our default namespace
we can check the pods here
If you check KIALI, you can see Data plane is added with 4 applications
If we check Data Plane
These are the 4 applications we have
basically reviews have 3 versions of it. So, we have 4 different applications with reviews having 3 application right now
But we have no traffic yet
Let’s generate some by creating a gateway which will allow traffic from outside the cluster
Let’s use this yaml file
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
Let’s check if things are fine using istioctl analyze
Now we need to find the IP through which we can access our local cluster
We can save this ip in a variable (INGRESS_HOST) to use properly
export INGRESS_HOST=$(minikube ip)
We also need to get the proper port number using this command
INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
echo $INGRESS_PORT
Here the port is 30093
http://$INGRESS_HOST:$INGRESS_PORT/productpage
Go to your browser and paste this
http://$INGRESS_HOST:$INGRESS_PORT/productpage
Then replace the value for the variable
http://192.168.49.2:30093/productpage
If you reload the page, you will see the colour of the review start changes meaning we have 3 versions of the reviews
Now if we check the graph page, we can see the traffic passed though which applications
In the Istio config page, we can also see the virtualservice and gateway we created earlier.
Now, if we delete the productpage, what will happen? Will kiali receive any traffic, healthchecks?
Let’s delete first
kubectl delete deployments/productpage-v1
from kiali, we can see the productpage-v1 is totally gone
We can see the services have no health checks