Skip to content

httpbin sample gateway for Istio

Scott Ganyo edited this page Feb 9, 2021 · 1 revision

The Istio samples do not generate a VirtualService and Gateway because they could conflict with ones that you already use. But here's a quick example that you can modify for your needs for access to the sample httpbin service from outside your mesh via Istio's ingressgateway:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: httpbin
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: httpbin
spec:
  hosts:
  - "*"
  gateways:
    - httpbin
  http:
  - match: 
    - uri:
        prefix: /httpbin
    route:
    - destination:
        host: httpbin
        port:
          number: 80
    rewrite:
      uri: /
      authority: httpbin.org