|
|
|
# Installation
|
|
|
|
|
|
|
|
- [istio](https://istio.io/docs/setup/kubernetes/install/kubernetes/)
|
|
|
|
- helm (Optional)
|
|
|
|
|
|
|
|
Pertama download dulu, [istio.io lastest version](https://istio.io/docs/setup/kubernetes/download/), kemudian gunakan script berikut:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
for i in install/kubernetes/helm/istio-init/files/crd*yaml; do kubectl apply -f $i; done
|
|
|
|
```
|
|
|
|
|
|
|
|
Setelah itu, kita active-kan istionya dengan menggunakan perintah berikut:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kubectl apply -f path-to-istio/install/kubernetes/istio-demo-auth.yaml
|
|
|
|
```
|
|
|
|
|
|
|
|
## Springboot running into pods
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kubectl label namespace default istio-injection=enabled
|
|
|
|
|
|
|
|
## apply proxy
|
|
|
|
kubectl apply -f kubernetes/istio.gateway.yaml
|
|
|
|
kubectl apply -f kubernetes/istio.virtualservice.yaml
|
|
|
|
```
|
|
|
|
|
|
|
|
check status is running:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
watch kubectl get pods -A
|
|
|
|
```
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
## Testing
|
|
|
|
|
|
|
|
Setelah run, kita bisa testing dengan perintah berikut:
|
|
|
|
|
|
|
|
Untuk request token
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X POST \
|
|
|
|
'http://<minikube ip>:31380/oauth/token?username=user&password=password&grant_type=password' \
|
|
|
|
-H 'Authorization: Basic Y2xpZW50LXdlYjoxMjM0NTY=' \
|
|
|
|
-H 'cache-control: no-cache'
|
|
|
|
```
|
|
|
|
|
|
|
|
Untuk request api:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X GET \
|
|
|
|
http://<minikube ip>:31380/api/example \
|
|
|
|
-H 'Authorization: Bearer [access-token]' \
|
|
|
|
-H 'cache-control: no-cache'
|
|
|
|
```
|
|
|
|
|
|
|
|
## Visualization mesh service
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=kiali -o jsonpath='{.items[0].metadata.name}') 20001:20001
|
|
|
|
```
|
|
|
|
|
|
|
|
visit [http://localhost:20001/kiali/console](http://localhost:20001/kiali/console)
|
|
|
|
|
|
|
|
Berikut adalah graph flow service mesh:
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
## Istio Dashboard
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=grafana -o jsonpath='{.items[0].metadata.name}') 3000:3000 &
|
|
|
|
```
|
|
|
|
|
|
|
|
visit [http://localhost:3000/dashboard/db/istio-mesh-dashboard](http://localhost:3000/dashboard/db/istio-mesh-dashboard)
|
|
|
|
|
|
|
|
 |