From d8573d9a427e5b8154b842b7a34438af29d8c092 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Tue, 28 Jul 2020 15:00:36 +0100 Subject: [PATCH 1/3] Switch Ingress concept to use MermaidJS diagrams Replace ASCII-art diagrams with MermaidJS-rendered drawings. --- .../concepts/services-networking/ingress.md | 74 ++++++++++++++----- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/content/en/docs/concepts/services-networking/ingress.md b/content/en/docs/concepts/services-networking/ingress.md index 24907f31e2..795a3546b5 100644 --- a/content/en/docs/concepts/services-networking/ingress.md +++ b/content/en/docs/concepts/services-networking/ingress.md @@ -29,13 +29,24 @@ For clarity, this guide defines the following terms: {{< link text="services" url="/docs/concepts/services-networking/service/" >}} within the cluster. Traffic routing is controlled by rules defined on the Ingress resource. -```none - internet - | - [ Ingress ] - --|-----|-- - [ Services ] -``` +Here is a simple example where an Ingress sends all its traffic to one Service: +{{< mermaid >}} +graph LR; + client([client])-. Ingress-managed
load balancer .->ingress[Ingress]; + ingress-->|routing rule|service[Service]; + subgraph cluster + ingress; + service-->pod1[Pod]; + service-->pod2[Pod]; + end + classDef plain fill:#ddd,stroke:#fff,stroke-width:4px,color:#000; + classDef k8s fill:#326ce5,stroke:#fff,stroke-width:4px,color:#fff; + classDef cluster fill:#fff,stroke:#bbb,stroke-width:2px,color:#326ce5; + class ingress,service,pod1,pod2 k8s; + class client plain; + class cluster cluster; +{{}} + An Ingress may be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL / TLS, and offer name-based virtual hosting. An [Ingress controller](/docs/concepts/services-networking/ingress-controllers) is responsible for fulfilling the Ingress, usually with a load balancer, though it may also configure your edge router or additional frontends to help handle the traffic. @@ -274,10 +285,25 @@ A fanout configuration routes traffic from a single IP address to more than one based on the HTTP URI being requested. An Ingress allows you to keep the number of load balancers down to a minimum. For example, a setup like: -``` -foo.bar.com -> 178.91.123.132 -> / foo service1:4200 - / bar service2:8080 -``` +{{< mermaid >}} +graph LR; + client([client])-. Ingress-managed
load balancer .->ingress[Ingress, 178.91.123.132]; + ingress-->|/foo|service1[Service service1:4200]; + ingress-->|/bar|service2[Service service2:8080]; + subgraph cluster + ingress; + service1-->pod1[Pod]; + service1-->pod2[Pod]; + service2-->pod3[Pod]; + service2-->pod4[Pod]; + end + classDef plain fill:#ddd,stroke:#fff,stroke-width:4px,color:#000; + classDef k8s fill:#326ce5,stroke:#fff,stroke-width:4px,color:#fff; + classDef cluster fill:#fff,stroke:#bbb,stroke-width:2px,color:#326ce5; + class ingress,service1,service2,pod1,pod2,pod3,pod4 k8s; + class client plain; + class cluster cluster; +{{}} would require an Ingress such as: @@ -321,11 +347,26 @@ you are using, you may need to create a default-http-backend Name-based virtual hosts support routing HTTP traffic to multiple host names at the same IP address. -```none -foo.bar.com --| |-> foo.bar.com service1:80 - | 178.91.123.132 | -bar.foo.com --| |-> bar.foo.com service2:80 -``` +{{< mermaid >}} +graph LR; + client([client])-. Ingress-managed
load balancer .->ingress[Ingress, 178.91.123.132]; + ingress-->|Host: foo.bar.com|service1[Service service1:80]; + ingress-->|Host: bar.foo.com|service2[Service service2:80]; + subgraph cluster + ingress; + service1-->pod1[Pod]; + service1-->pod2[Pod]; + service2-->pod3[Pod]; + service2-->pod4[Pod]; + end + classDef plain fill:#ddd,stroke:#fff,stroke-width:4px,color:#000; + classDef k8s fill:#326ce5,stroke:#fff,stroke-width:4px,color:#fff; + classDef cluster fill:#fff,stroke:#bbb,stroke-width:2px,color:#326ce5; + class ingress,service1,service2,pod1,pod2,pod3,pod4 k8s; + class client plain; + class cluster cluster; +{{}} + The following Ingress tells the backing load balancer to route requests based on the [Host header](https://tools.ietf.org/html/rfc7230#section-5.4). @@ -508,4 +549,3 @@ You can expose a Service in multiple ways that don't directly involve the Ingres * Learn about the [Ingress API](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#ingress-v1beta1-networking-k8s-io) * Learn about [Ingress controllers](/docs/concepts/services-networking/ingress-controllers/) * [Set up Ingress on Minikube with the NGINX Controller](/docs/tasks/access-application-cluster/ingress-minikube/) - From ed749d19f689b0d2872f8bf33533fe97dfcaa84c Mon Sep 17 00:00:00 2001 From: Celeste Horgan Date: Thu, 3 Sep 2020 11:23:46 -0700 Subject: [PATCH 2/3] Add overflow CSS for mermaid.js diagrams --- assets/scss/_custom.scss | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/assets/scss/_custom.scss b/assets/scss/_custom.scss index ebe073a686..6992a5ee3d 100644 --- a/assets/scss/_custom.scss +++ b/assets/scss/_custom.scss @@ -61,6 +61,15 @@ body.td-404 main .error-details { margin-bottom: 0; } +/* Global - Mermaid.js diagrams */ + +.mermaid { + overflow: scroll; + max-width: 80%; + border: 1px solid rgb(222, 226, 230); + border-radius: 5px; +} + /* HEADER */ .td-navbar { @@ -542,3 +551,5 @@ body.td-documentation { } } } + + From 61fdeb79bfcfd9dc32f2fc7deaed55ab4f99dd0d Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Tue, 22 Sep 2020 18:46:53 +0100 Subject: [PATCH 3/3] Switch Mermaid scrollbar to automatic --- assets/scss/_custom.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/assets/scss/_custom.scss b/assets/scss/_custom.scss index 6992a5ee3d..f511e05e3b 100644 --- a/assets/scss/_custom.scss +++ b/assets/scss/_custom.scss @@ -64,7 +64,7 @@ body.td-404 main .error-details { /* Global - Mermaid.js diagrams */ .mermaid { - overflow: scroll; + overflow-x: auto; max-width: 80%; border: 1px solid rgb(222, 226, 230); border-radius: 5px; @@ -552,4 +552,3 @@ body.td-documentation { } } -