Skip to content

Commit

Permalink
Added explanation for Invoking External Service from pods
Browse files Browse the repository at this point in the history
Added explanation for Invoking External Service from pods
  • Loading branch information
yoshioterada committed Jun 12, 2018
1 parent 305b0d0 commit e716928
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Kubernetes-Workshop6.md
Expand Up @@ -1040,11 +1040,11 @@ $ curl http://40.xxx.xxx.xxx/app/front/top/trans-service?eng=this%20is%20a%20pen

### 6.4.8 Invoke External Service from pods.

By default, Istio is not able to access to the external service from individual pod. For detail please refer to the [Control Egress Traffic](https://istio.io/docs/tasks/traffic-management/egress/).
By default, Istio is not able to access to the external service like external DB and others from internal pod. For detail explanation, please refer to the [Control Egress Traffic](https://istio.io/docs/tasks/traffic-management/egress/)?

For example, in my Microsoft Translator Text service, it invoke the URL of "[https://api.microsofttranslator.com/v2/http.svc/Translate](https://api.microsofttranslator.com/v2/http.svc/Translate)" from program code. Also if you created the DB outside of k8s cluster, you need this kind of configuration.
For example, in my sample Application ([Microsoft Translator Text service](https://azure.microsoft.com/services/cognitive-services/translator-text-api/)), it invoke to the external service as "[https://api.microsofttranslator.com/v2/http.svc/Translate](https://api.microsofttranslator.com/v2/http.svc/Translate)" from programing code. It is not accessible from the default configuration.

In fact, in this situation, if you invoke the external service, you cann see like following error.
In this situation, if you invoke the external service, you will see like following error.

```
$ curl http://40.xxx.xxx.xxx/app/front/top/trans-service?eng=this%20is%20a%20ball
Expand Down Expand Up @@ -1084,7 +1084,9 @@ $ curl http://40.xxx.xxx.xxx/app/front/top/trans-service?eng=this%20is%20a%20bal



In order to access to the external service, In this [Control Egress Traffic](https://istio.io/docs/tasks/traffic-management/egress/) entry, Helm packaging tool is used. However you can also configure the metadata for "***traffic.sidecar.istio.io/includeOutboundIPRanges***" annotation in Deployment file like follows.
In order to access to the external service, there is some way to configure. For example, the original documentation of the [Control Egress Traffic](https://istio.io/docs/tasks/traffic-management/egress/) entry, it used Helm packaging tool.

However we can configure directly to the metadata for "***traffic.sidecar.istio.io/includeOutboundIPRanges***" annotation in Deployment file like follows.

```
apiVersion: apps/v1
Expand Down Expand Up @@ -1121,6 +1123,8 @@ After added the entry of ***traffic.sidecar.istio.io/includeOutboundIPRanges: 10
/usr/local/bin/kubectl apply --record -f <(/usr/local/bin/istioctl kube-inject -f ./create-deployment-v4.yaml)
```

Then you can access to the external service from pod.

```
$ curl http://40.xxx.xxx.xxx/app/front/top/trans-service?eng=this%20is%20a%20pen
{"hostname":"trans-text-service-v4-58c9d69c8b-dzcdj","value":"これはペンです。","version":"version-4"}$
Expand Down

0 comments on commit e716928

Please sign in to comment.