In previous example we were able to see the version graph for our Microservice components.
http://siddharathadhumale.blogspot.com/2021/06/deploying-different-version-of.html
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.
![](https://shdhumale.files.wordpress.com/2021/06/i1-6.jpg?w=1024)
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
![](https://shdhumale.files.wordpress.com/2021/06/i2-6.jpg?w=874)
Create Namespce
C:\Users\Siddhartha>kubectl create namespace springboot-application
![](https://shdhumale.files.wordpress.com/2021/06/i3-6.jpg?w=566)
Label namespace with istio-injection=enabled
C:\Users\Siddhartha>kubectl label namespace springboot-application istio-injection=enabled
![](https://shdhumale.files.wordpress.com/2021/06/i4-6.jpg?w=714)
Check namespace is labeled properly
C:\Users\Siddhartha>kubectl get ns springboot-application –-show-labels
![](https://shdhumale.files.wordpress.com/2021/06/i5-5.jpg?w=823)
Apply gateway
C:\Istio-workspace>kubectl apply -f gatewayV1.yaml
![](https://shdhumale.files.wordpress.com/2021/06/i6-5.jpg?w=437)
Apply Virtual service
C:\Istio-workspace>kubectl apply -f virtual-serviceV1.yaml
![](https://shdhumale.files.wordpress.com/2021/06/i7-4.jpg?w=452)
Apply Producer-Pod-v1
C:\Istio-workspace>kubectl apply -f springboot-docker-producerV1.yaml
![](https://shdhumale.files.wordpress.com/2021/06/i8-5.jpg?w=557)
Apply Producer-Pod-v2
C:\Istio-workspace>kubectl apply -f springboot-docker-producerV2.yaml
![](https://shdhumale.files.wordpress.com/2021/06/i9-6.jpg?w=532)
Apply consumer-Pod-v1
C:\Istio-workspace>kubectl apply -f springboot-docker-consumerV1.yaml
![](https://shdhumale.files.wordpress.com/2021/06/i10-3.jpg?w=549)
check all containers are in running mode
C:\Istio-workspace>kubectl get all -n springboot-application -o wide
![](https://shdhumale.files.wordpress.com/2021/06/i11-3.jpg?w=1024)
Apply kiali and other add ons
C:\Users\Siddhartha>kubectl apply -f C:\istio-1.10.1\samples\addons
![](https://shdhumale.files.wordpress.com/2021/06/i12-2.jpg?w=874)
Get all svc for istio-system.
C:\Istio-workspace>kubectl get svc -n istio-system
![](https://shdhumale.files.wordpress.com/2021/06/i13-2.jpg?w=869)
Check if the required kiali pod is ready to be exposed.
C:\Istio-workspace>kubectl get pod -n istio-system
![](https://shdhumale.files.wordpress.com/2021/06/i14-2.jpg?w=531)
Open the kiali ui using forward
C:\Users\Siddhartha>kubectl port-forward svc/kiali -n istio-system 20001
Check pod is ready for forwarding
C:\Istio-workspace> kubectl get all -n springboot-application -o wide
![](https://shdhumale.files.wordpress.com/2021/06/i17-2.jpg?w=1024)
Open the Producer-Pod-v1 on browser using forward
C:\Users\Siddhartha>kubectl port-forward 8091:8091 -n springboot-application
![](https://shdhumale.files.wordpress.com/2021/06/i18-2.jpg?w=944)
![](https://shdhumale.files.wordpress.com/2021/06/i19-2.jpg?w=560)
Open the consumer-Pod-v1 on browser using forward
C:\Users\Siddhartha>kubectl port-forward 8090:8090 -n springboot-application
Loop the request to check if we are getting he flow chart on Kiali
C:\Users\Siddhartha>curl http://localhost:8090/getEmployee?%5B1-200%5D; sleep 2;
![](https://shdhumale.files.wordpress.com/2021/06/i22-1.jpg?w=1024)
Now lets try to access the same using dns name
Make sure to enter following entries inside your host files
127.0.0.1 mysiddhuweb.example.com
![](https://shdhumale.files.wordpress.com/2021/06/i23-2.jpg?w=1000)
Now lets run C:\Users\Siddhartha>curl http://mysiddhuweb.example.com/getEmployee?%5B1-200%5D; sleep 2;
You can download the code from here
Producer GIT
https://github.com/shdhumale/springboot-docker-producer.git
Consumer
https://github.com/shdhumale/springboot-docker-consumer-version.git
YAML Files
https://github.com/shdhumale/kialiyaml.git
No comments:
Post a Comment