github.com/cilium/cilium@v1.16.2/Documentation/network/servicemesh/gateway-api/http.rst (about) 1 .. only:: not (epub or latex or html) 2 3 WARNING: You are looking at unreleased Cilium documentation. 4 Please use the official rendered version released here: 5 https://docs.cilium.io 6 7 .. _gs_gateway_http: 8 9 ************ 10 HTTP Example 11 ************ 12 13 In this example, we will deploy a simple HTTP service and expose it to the 14 Cilium Gateway API. 15 16 The demo application is from the ``bookinfo`` demo microservices app from 17 the Istio project. 18 19 .. include:: ../demo-app.rst 20 21 Deploy the Cilium Gateway 22 ========================= 23 24 You'll find the example Gateway and HTTPRoute definition in ``basic-http.yaml``. 25 26 .. literalinclude:: ../../../../examples/kubernetes/gateway/basic-http.yaml 27 28 .. parsed-literal:: 29 30 $ kubectl apply -f \ |SCM_WEB|\/examples/kubernetes/gateway/basic-http.yaml 31 32 The above example creates a Gateway named ``my-gateway`` that listens on port 80. 33 Two routes are defined, one for ``/details`` to the ``details`` service, and 34 one for ``/`` to the ``productpage`` service. 35 36 Your cloud provider will automatically provision an external IP address for the 37 gateway, but it may take up to 20 minutes. 38 39 .. code-block:: shell-session 40 41 $ kubectl get gateway my-gateway 42 NAME CLASS ADDRESS PROGRAMMED AGE 43 my-gateway cilium 10.100.26.37 True 2d7h 44 45 .. Note:: 46 47 Some providers e.g. EKS use a fully-qualified domain name rather than an IP address. 48 49 Make HTTP Requests 50 ================== 51 52 Now that the Gateway is ready, you can make HTTP requests to the services. 53 54 .. code-block:: shell-session 55 56 $ GATEWAY=$(kubectl get gateway my-gateway -o jsonpath='{.status.addresses[0].value}') 57 $ curl --fail -s http://"$GATEWAY"/details/1 | jq 58 { 59 "id": 1, 60 "author": "William Shakespeare", 61 "year": 1595, 62 "type": "paperback", 63 "pages": 200, 64 "publisher": "PublisherA", 65 "language": "English", 66 "ISBN-10": "1234567890", 67 "ISBN-13": "123-1234567890" 68 } 69 $ curl -v -H 'magic: foo' http://"$GATEWAY"\?great\=example 70 ... 71 <!DOCTYPE html> 72 <html> 73 <head> 74 <title>Simple Bookstore App</title> 75 <meta charset="utf-8"> 76 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 77 <meta name="viewport" content="width=device-width, initial-scale=1"> 78 79 <!-- Latest compiled and minified CSS --> 80 <link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css"> 81 82 <!-- Optional theme --> 83 <link rel="stylesheet" href="static/bootstrap/css/bootstrap-theme.min.css"> 84 85 </head> 86 <body> 87 88 89 <p> 90 <h3>Hello! This is a simple bookstore application consisting of three services as shown below</h3> 91 </p> 92 93 <table class="table table-condensed table-bordered table-hover"><tr><th>name</th><td>http://details:9080</td></tr><tr><th>endpoint</th><td>details</td></tr><tr><th>children</th><td><table class="table table-condensed table-bordered table-hover"><tr><th>name</th><th>endpoint</th><th>children</th></tr><tr><td>http://details:9080</td><td>details</td><td></td></tr><tr><td>http://reviews:9080</td><td>reviews</td><td><table class="table table-condensed table-bordered table-hover"><tr><th>name</th><th>endpoint</th><th>children</th></tr><tr><td>http://ratings:9080</td><td>ratings</td><td></td></tr></table></td></tr></table></td></tr></table> 94 95 <p> 96 <h4>Click on one of the links below to auto generate a request to the backend as a real user or a tester 97 </h4> 98 </p> 99 <p><a href="/productpage?u=normal">Normal user</a></p> 100 <p><a href="/productpage?u=test">Test user</a></p> 101 102 103 104 <!-- Latest compiled and minified JavaScript --> 105 <script src="static/jquery.min.js"></script> 106 107 <!-- Latest compiled and minified JavaScript --> 108 <script src="static/bootstrap/js/bootstrap.min.js"></script> 109 110 </body> 111 </html>