Skip to content

Commit 6c5685b

Browse files
Kaitlyn Barnardk8s-ci-robot
authored andcommitted
Blog Post: Dynamic Ingress in Kubernetes (kubernetes#8865)
* adding files for blog post * Update 2018-06-01-dynamic-ingress-kubernetes.md
1 parent 8f5cdde commit 6c5685b

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
layout: blog
3+
title: Dynamic Ingress in Kubernetes
4+
date: Friday, June 1, 2018
5+
---
6+
7+
**Author**: Richard Li (Datawire)
8+
9+
Kubernetes makes it easy to deploy applications that consist of many microservices, but one of the key challenges with this type of architecture is dynamically routing ingress traffic to each of these services. One approach is [Ambassador](https://www.getambassador.io), a Kubernetes-native open source API Gateway built on the [Envoy Proxy](https://www.envoyproxy.io). Ambassador is designed for dynamic environment where services may come and go frequently.
10+
11+
Ambassador is configured using Kubernetes annotations. Annotations are used to configure specific mappings from a given Kubernetes service to a particular URL. A mapping can include a number of annotations for configuring a route. Examples include rate limiting, protocol, cross-origin request sharing, traffic shadowing, and routing rules.
12+
13+
## A Basic Ambassador Example
14+
15+
Ambassador is typically installed as a Kubernetes deployment, and is also available as a Helm chart. To configure Ambassador, create a Kubernetes service with the Ambassador annotations. Here is an example that configures Ambassador to route requests to /httpbin/ to the public httpbin.org service:
16+
17+
```
18+
apiVersion: v1
19+
kind: Service
20+
metadata:
21+
name: httpbin
22+
annotations:
23+
getambassador.io/config: |
24+
---
25+
apiVersion: ambassador/v0
26+
kind: Mapping
27+
name: httpbin_mapping
28+
prefix: /httpbin/
29+
service: httpbin.org:80
30+
host_rewrite: httpbin.org
31+
spec:
32+
type: ClusterIP
33+
ports:
34+
- port: 80
35+
```
36+
37+
A mapping object is created with a prefix of /httpbin/ and a service name of httpbin.org. The host_rewrite annotation specifies that the HTTP `host` header should be set to httpbin.org.
38+
39+
## Kubeflow
40+
41+
[Kubeflow](https://github.com/kubeflow/kubeflow) provides a simple way to easily deploy machine learning infrastructure on Kubernetes. The Kubeflow team needed a proxy that provided a central point of authentication and routing to the wide range of services used in Kubeflow, many of which are ephemeral in nature.
42+
43+
![kubeflow](/images/blog/2018-06-01-dynamic-ingress-kubernetes/kubeflow.png)
44+
<center><i>Kubeflow architecture, pre-Ambassador</center></i>
45+
46+
## Service configuration
47+
48+
With Ambassador, Kubeflow can use a distributed model for configuration. Instead of a central configuration file, Ambassador allows each service to configure its route in Ambassador via Kubernetes annotations. Here is a simplified example configuration:
49+
50+
```
51+
---
52+
apiVersion: ambassador/v0
53+
kind: Mapping
54+
name: tfserving-mapping-test-post
55+
prefix: /models/test/
56+
rewrite: /model/test/:predict
57+
method: POST
58+
service: test.kubeflow:8000
59+
```
60+
61+
In this example, the “test” service uses Ambassador annotations to dynamically configure a route to the service, triggered only when the HTTP method is a POST, and the annotation also specifies a rewrite rule.
62+
63+
## Kubeflow and Ambassador
64+
65+
![kubeflow-ambassador](/images/blog/2018-06-01-dynamic-ingress-kubernetes/kubeflow-ambassador.png)
66+
67+
With Ambassador, Kubeflow manages routing easily with Kubernetes annotations. Kubeflow configures a single ingress object that directs traffic to Ambassador, then creates services with Ambassador annotations as needed to direct traffic to specific backends. For example, when deploying TensorFlow services, Kubeflow creates and and annotates a K8s service so that the model will be served at https://<ingress host>/models/<model name>/. Kubeflow can also use the Envoy Proxy to do the actual L7 routing. Using Ambassador, Kubeflow takes advantage of additional routing configuration like URL rewriting and method-based routing.
68+
69+
If you’re interested in using Ambassador with Kubeflow, the standard Kubeflow install automatically installs and configures Ambassador.
70+
71+
If you’re interested in using Ambassador as an API Gateway or Kubernetes ingress solution for your non-Kubeflow services, check out the [Getting Started with Ambassador guide](https://www.getambassador.io/user-guide/getting-started).
37.2 KB
Loading
29.5 KB
Loading

0 commit comments

Comments
 (0)