In Example 9-36 on page 313 we have created a serviceentry and a virtualservice to allow access to an external HTTP service. Note that for TLS protocols, including HTTPS, the TLS virtualservice is required in addition to the serviceentry. 

1. Create a ServiceEntry to allow access to an external HTTP service Example 9-37. 

root@scamp1:~/istio_lab#kubectl apply -f - apiVersion: networking.istio.io/v1alpha3 kind: ServiceEntry metadata: name: httpbin-ext spec: hosts: - httpbin.org ports: - number: 80 name: http protocol: HTTP resolution: DNS location: MESH_EXTERNAL EOF 

2. Make requests to the external services. Make an HTTP outbound request to httpbin.org from the user pod, as shown in Example 9-38. 

root@scamp1:~/istio_lab# export SOURCE_POD=$(kubectl get pod -l app=user -o jsonpath={.items..metadata.name}) root@scamp1:~/istio_lab# kubectl exec -it $SOURCE_POD -c user curl http://httpbin.org/headers { "headers": { "Accept": "*/*", "Cache-Control": "max-stale=0", "Host": "httpbin.org", "If-Modified-Since": "Thu, 14 Mar 2019 06:00:44 GMT", "User-Agent": "curl/7.38.0", "X-B3-Sampled": "1", "X-B3-Spanid": "51c9d4d21b2e4f7c", "X-B3-Traceid": "51c9d4d21b2e4f7c", "X-Bluecoat-Via": "6f5b02aba0abb15e", "X-Envoy-Decorator-Operation": "httpbin.org:80/*", "X-Istio-Attributes": "CikKGGRlc3RpbmF0aW9uLnNlcnZpY2UubmFtZRINEgtodHRwYmluLm9yZwoqCh1kZXN0aW5hdGlvbi5zZ XJ2aWNlLm5hbWVzcGFjZRIJEgdkZWZhdWx0CiQKE2Rlc3RpbmF0aW9uLnNlcnZpY2USDRILaHR0cGJpbi5 vcmcKPQoKc291cmNlLnVpZBIvEi1rdWJlcm5ldGVzOi8vdXNlci12MS02YjVjNzRiNDc3LXd4dGN6LmRlZ mF1bHQKKQoYZGVzdGluYXRpb24uc2VydmljZS5ob3N0Eg0SC2h0dHBiaW4ub3Jn" } } 

