Also lets try to access our microservice using url i.e. DNS name and using gateway and virtualservice rather than exposing it using port-forward and accessing it using localhost.
Please follow belwo step religiously. We assume you have complete new docker and kubernetes env without installation of ISTIO.
Check istio system have svc for istio-ingressgateway and it should either be having external IP as localhost or ipaddress. C:\Users\Siddhartha>kubectl -n istio-system get svc istio-ingressgateway
Now lets install the producer microservice using different version and do the canary deployement at runtime. Also lets try to access our microservice using url rather than exposing it using port-forward and accessing it using localhost.
First lets clean our currently installed all pod using below screen.
Again install ISTIO in the system using below command
C:\Users\Siddhartha>kubectl create namespace springboot-application namespace/springboot-application created
Step 3:- Enable/inject ISTIO on this name space C:\Users\Siddhartha>kubectl label namespace springboot-application istio-injection=enabled
C:\Users\Siddhartha>kubectl get ns springboot-application –-show-labels NAME STATUS AGE LABELS springboot-application Active 22m istio-injection=enabled
Step 4:- Execute all the yaml in sequence given below.
kubectl apply -f gateway.yaml
C:\Istio-workspace>kubectl apply -f gateway.yaml gateway.networking.istio.io/mysiddhuweb-gateway created
kubectl apply -f virtual-service.yaml
C:\Istio-workspace>kubectl apply -f virtual-service.yaml virtualservice.networking.istio.io/mysiddhuweb-vs created
C:\Istio-workspace>kubectl apply -f springboot-docker-producerV1.yaml deployment.apps/springboot-docker-producer-v1 created service/siddhuproducer created
Now lets install Kaili again (as we have deleted all the pod in the K8 env.)
Now lets apply all this kubernetes yml file as shown below
C:\Users\Siddhartha>kubectl apply -f C:\istio-1.10.1\samples\addons serviceaccount/grafana unchanged configmap/grafana unchanged service/grafana unchanged deployment.apps/grafana configured configmap/istio-grafana-dashboards configured configmap/istio-services-grafana-dashboards configured deployment.apps/jaeger unchanged service/tracing unchanged service/zipkin unchanged service/jaeger-collector unchanged customresourcedefinition.apiextensions.k8s.io/monitoringdashboards.monitoring.kiali.io unchanged serviceaccount/kiali unchanged configmap/kiali unchanged clusterrole.rbac.authorization.k8s.io/kiali-viewer unchanged clusterrole.rbac.authorization.k8s.io/kiali unchanged clusterrolebinding.rbac.authorization.k8s.io/kiali unchanged role.rbac.authorization.k8s.io/kiali-controlplane unchanged rolebinding.rbac.authorization.k8s.io/kiali-controlplane unchanged service/kiali unchanged deployment.apps/kiali unchanged monitoringdashboard.monitoring.kiali.io/envoy created monitoringdashboard.monitoring.kiali.io/go created monitoringdashboard.monitoring.kiali.io/kiali created monitoringdashboard.monitoring.kiali.io/micrometer-1.0.6-jvm-pool created monitoringdashboard.monitoring.kiali.io/micrometer-1.0.6-jvm created monitoringdashboard.monitoring.kiali.io/micrometer-1.1-jvm created monitoringdashboard.monitoring.kiali.io/microprofile-1.1 created monitoringdashboard.monitoring.kiali.io/microprofile-x.y created monitoringdashboard.monitoring.kiali.io/nodejs created monitoringdashboard.monitoring.kiali.io/quarkus created monitoringdashboard.monitoring.kiali.io/springboot-jvm-pool created monitoringdashboard.monitoring.kiali.io/springboot-jvm created monitoringdashboard.monitoring.kiali.io/springboot-tomcat created monitoringdashboard.monitoring.kiali.io/thorntail created monitoringdashboard.monitoring.kiali.io/tomcat created monitoringdashboard.monitoring.kiali.io/vertx-client created monitoringdashboard.monitoring.kiali.io/vertx-eventbus created monitoringdashboard.monitoring.kiali.io/vertx-jvm created monitoringdashboard.monitoring.kiali.io/vertx-pool created monitoringdashboard.monitoring.kiali.io/vertx-server created serviceaccount/prometheus unchanged configmap/prometheus unchanged clusterrole.rbac.authorization.k8s.io/prometheus unchanged clusterrolebinding.rbac.authorization.k8s.io/prometheus unchanged service/prometheus unchanged deployment.apps/prometheus configured
now lets check how many pods we were havig in istio-system name space
C:\Users\Siddhartha>kubectl get pod -n istio-system
C:\Istio-workspace>kubectl get pod -n istio-system NAME READY STATUS RESTARTS AGE grafana-f766d6c97-5hfzb 1/1 Running 0 2m43s istio-ingressgateway-f6c955cd8-ddqrj 1/1 Running 0 34m istiod-58bb7c6644-9b746 1/1 Running 0 34m jaeger-7f78b6fb65-k4lkk 1/1 Running 0 2m41s kiali-85c8cdd5b5-hpvjg 1/1 Running 0 2m33s prometheus-69f7f4d689-b7d8j 2/2 Running 0 2m29s
Now as shown above in past we have only 2 pod istiod-58bb7c6644-9b746 and istio-ingressgateway-f6c955cd8-ddqrj but now we have all other pod for respective yml files running in name space istio-system.
Please refer to the documentation and see what these pod do for you in ISTIO. prometheus, kiali, jaeger and grafana
first get the service and then do port-forward kiali port forward and open it into the browser so that we can access it url.
C:\Users\Siddhartha>kubectl get svc -n istio-system
1
2
3
4
5
6
7
8
9
10
C:\Istio-workspace>kubectl get svc -n istio-system
Now lets do port-forward for kiali so that we can see the graphs.
C:\Users\Siddhartha>kubectl port-forward svc/kiali -n istio-system 20001 Forwarding from 127.0.0.1:20001 -> 20001 Forwarding from [::1]:20001 -> 20001
Now lets try to do first port-forward for producer and consumer to see the graph on kiali.
Now lets check we are able to access our producer and consumer using forward port
C:\Istio-workspace>kubectl get pod -n springboot-application NAME READY STATUS RESTARTS AGE springboot-docker-consumer-69cd4b98f-8rjvf 2/2 Running 0 24m springboot-docker-producer-v1-84f8f77fdc-hwm5m 2/2 Running 0 5m7s springboot-docker-producer-v2-7bd9d8bfdb-s7lpm 2/2 Running 0 5m16s
Lets check if producer v1 microservice is working kubectl port-forward springboot-docker-producer-v1-84f8f77fdc-hwm5m 8091:8091 -n springboot-application
C:\Users\Siddhartha>kubectl port-forward springboot-docker-producer-v1-84f8f77fdc-hwm5m 8091:8091 -n springboot-application Forwarding from 127.0.0.1:8091 -> 8091 Forwarding from [::1]:8091 -> 8091
C:\Users\Siddhartha>kubectl port-forward springboot-docker-consumer-69cd4b98f-8rjvf 8090:8090 -n springboot-application Forwarding from 127.0.0.1:8090 -> 8090 Forwarding from [::1]:8090 -> 8090
Note:- To see the traffic flow you need to execute the url in loop so use below comments