Skip to content

Commit

Permalink
feat(reachableservices): add docs about auto reachable services
Browse files Browse the repository at this point in the history
Signed-off-by: slonka <[email protected]>
  • Loading branch information
slonka committed Nov 6, 2023
1 parent c42387b commit effc755
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions app/_src/production/upgrades-tuning/fine-tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,103 @@ The result is that:

Follow the {% if_version lte:2.1.x %}[transparent proxying](/docs/{{ page.version }}/networking/transparent-proxying){% endif_version %}{% if_version gte:2.2.x %}[transparent proxying](/docs/{{ page.version }}/production/dp-config/transparent-proxying/){% endif_version %} docs on how to configure it.

{% if_version gte:2.5.x %}
## Config trimming by using MeshTrafficPermission

Check warning on line 20 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Headings] 'Config trimming by using MeshTrafficPermission' should use sentence-style capitalization. Raw Output: {"message": "[Google.Headings] 'Config trimming by using MeshTrafficPermission' should use sentence-style capitalization.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 20, "column": 4}}}, "severity": "WARNING"}

Starting with release 2.5 the problem stated in [reachable services](#reachable-services) section
can be also mitigated by defining MeshTrafficPermissions in combination with:
- `{{site.set_flag_values_prefix}}.experimental.autoReachableServices` flag (or `KUMA_EXPERIMENTAL_AUTO_REACHABLE_SERVICES` environment variable) and

Check warning on line 24 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 24, "column": 1}}}, "severity": "INFO"}
- [mTLS enabled in strict mode](/docs/{{ page.version }}/policies/mutual-tls/)

Switching on the flag will result in computing a graph of dependencies between the services

Check warning on line 27 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 27, "column": 23}}}, "severity": "WARNING"}
and generating XDS configuration that enables communication **only** with services that are allowed to communicate with each other,

Check warning on line 28 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Acronyms] Spell out 'XDS', if it's unfamiliar to the audience. Raw Output: {"message": "[Google.Acronyms] Spell out 'XDS', if it's unfamiliar to the audience.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 28, "column": 16}}}, "severity": "INFO"}

Check warning on line 28 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('are allowed'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('are allowed').", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 28, "column": 89}}}, "severity": "INFO"}
meaning: their [effective](/docs/{{ page.version }}/policies/targetref/#merging-configuration) action is **not** `deny`.

Check warning on line 29 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 29, "column": 27}}}, "severity": "INFO"}

Check failure on line 29 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'targetRef' instead of 'targetref'. Raw Output: {"message": "[Vale.Terms] Use 'targetRef' instead of 'targetref'.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 29, "column": 62}}}, "severity": "ERROR"}

For example: if a service `b` can be called only by service `a`:

Check warning on line 31 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('be called'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('be called').", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 31, "column": 35}}}, "severity": "INFO"}

```yaml
apiVersion: kuma.io/v1alpha1
kind: MeshTrafficPermission
metadata:
namespace: kuma-system
name: mtp-b
spec:
targetRef:
kind: MeshService
name: b
from:
- targetRef:
kind: MeshService
name: a
default:
action: Allow
```
Then there is no reason to compute and distribute configuration of service `b` to any other services in the Mesh since (even if they wanted)

Check warning on line 51 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 51, "column": 120}}}, "severity": "INFO"}
they wouldn't be able to communicate with it.

{% tip %}
You can combine `autoReachableServices` with [reachable services](#reachable-services), but **reachable services** will take precedence.

Check warning on line 55 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 55, "column": 116}}}, "severity": "WARNING"}
{% endtip %}

Sections below highlight the most important aspects of this feature, if you want to dig deeper please take a look at the [MADR](https://github.com/kumahq/kuma/blob/master/docs/madr/decisions/031-automatic-rechable-services.md#automatic-reachable-services).

Check warning on line 58 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Acronyms] Spell out 'MADR', if it's unfamiliar to the audience. Raw Output: {"message": "[Google.Acronyms] Spell out 'MADR', if it's unfamiliar to the audience.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 58, "column": 123}}}, "severity": "INFO"}

### Supported targetRef kinds

The following kinds affect the graph generation and performance:
- all levels of `MeshService`
- [top](/docs/{{ page.version }}/policies/targetref/#target-resources) level `MeshSubset` and `MeshServiceSubset` with `k8s.kuma.io/namespace`, `k8s.kuma.io/service`, `k8s.kuma.io/port` labels

Check failure on line 64 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'targetRef' instead of 'targetref'. Raw Output: {"message": "[Vale.Terms] Use 'targetRef' instead of 'targetref'.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 64, "column": 43}}}, "severity": "ERROR"}
- [from](/docs/{{ page.version }}/policies/targetref/#target-resources) level `MeshSubset` and `MeshServiceSubset` with all labels

Check failure on line 65 in app/_src/production/upgrades-tuning/fine-tuning.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'targetRef' instead of 'targetref'. Raw Output: {"message": "[Vale.Terms] Use 'targetRef' instead of 'targetref'.", "location": {"path": "app/_src/production/upgrades-tuning/fine-tuning.md", "range": {"start": {"line": 65, "column": 44}}}, "severity": "ERROR"}

If you define a MeshTrafficPermission with other kind, like this one:

```yaml
apiVersion: kuma.io/v1alpha1
kind: MeshTrafficPermission
metadata:
namespace: kuma-system
name: mtp-mesh-to-mesh
spec:
targetRef:
kind: MeshSubset
tags:
customLabel: true
from:
- targetRef:
kind: Mesh
default:
action: Allow
```

it won't affect performance.

### Changes to the communication between services

Requests from services trying to communicate with services that they don't have access to will now fail with connection closed error like this:

```bash
```bash
root@second-test-server:/# curl -v first-test-server:80
* Trying [IP]:80...
* Connected to first-test-server ([IP]) port 80 (#0)
> GET / HTTP/1.1
> Host: first-test-server
> User-Agent: curl/7.81.0
> Accept: */*
>
* Empty reply from server
* Closing connection 0
curl: (52) Empty reply from server
```
instead of getting a 403 with "RBAC: access denied" error.
### Migration
A recommended path of migration is to start with a coarse grain MeshTrafficPermission targeting a namespace and then drill down to individual services if needed.
{% endif_version %}
## Postgres
If you choose `Postgres` as a configuration store for {{site.mesh_product_name}} on Universal,
Expand Down

0 comments on commit effc755

Please sign in to comment.