-
Notifications
You must be signed in to change notification settings - Fork 96
docs: add logging section for control/data planes & DNS #2198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
4b1e030
9336ed1
41ee043
73e16f1
ad775d8
4b1d4cc
089a7a9
17169f9
a41428f
232edc6
8fb6b6f
972dc19
df0315f
1f361ea
4e55e88
608164b
d7c1ce9
89c2870
2a8f4c4
d78ce15
0cf0701
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,181 @@ | ||||
| --- | ||||
| title: Logging | ||||
| --- | ||||
|
|
||||
| When encountering issues, it is often necessary to increase logging levels to gain further insight into the problem. Below, we will explore the options for changing the log levels of various components in both Kubernetes and Universal deployments. | ||||
|
|
||||
| ## Adjusting logging levels for Kuma-DP | ||||
| Logging levels can be adjusted on a per-kuma-dp-based component basis. These components include: | ||||
|
|
||||
| * Data plane proxies | ||||
| * Zone ingress | ||||
| * Zone egress | ||||
|
|
||||
|
|
||||
| The available Envoy logging levels are: | ||||
|
|
||||
| * trace | ||||
| * debug | ||||
| * info | ||||
| * warning/warn | ||||
| * error | ||||
| * critical | ||||
| * off | ||||
|
|
||||
| See `ALL_LOGGER_IDS` in [logger.h from Envoy source](https://github.com/envoyproxy/envoy/blob/main/source/common/common/logger.h#L36) for a list of available components. | ||||
|
|
||||
|
|
||||
| {% tabs %} | ||||
| {% tab Kubernetes %} | ||||
| **Option 1: Annotations** | ||||
|
|
||||
| The below annotations can be used to adjust logging levels and components: | ||||
|
|
||||
| `kuma.io/envoy-log-level`: Specifies the log level for Envoy system logs to enable (affects all components). | ||||
|
|
||||
| `kuma.io/envoy-component-log-level`: Specifies the log level for Envoy system logs to enable by component. This allows targeting specific components, each with its own log level. | ||||
|
|
||||
| **Note**: These annotations must be added to the pod or pod template of a workload. Making this change will trigger a `restart` or `rollout` of the workload. | ||||
|
|
||||
| All components: | ||||
| ```yaml | ||||
| spec: | ||||
| selector: | ||||
| matchLabels: | ||||
| app: postgres | ||||
| replicas: 1 | ||||
| template: | ||||
| metadata: | ||||
| annotations: | ||||
| kuma.io/envoy-log-level: debug | ||||
| kuma.io/envoy-component-log-level: dns:debug | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line is not for "all components"
Suggested change
|
||||
| ``` | ||||
|
|
||||
| Targeted Components: | ||||
| ```yaml | ||||
| spec: | ||||
| selector: | ||||
| matchLabels: | ||||
| app: postgres | ||||
| replicas: 1 | ||||
| template: | ||||
| metadata: | ||||
| annotations: | ||||
| kuma.io/envoy-component-log-level: "dns:debug,connection:trace" | ||||
| ``` | ||||
| **Option 2: Port forwarding** | ||||
| The Envoy interface can also be accessed directly. This can be achieved using Kubernetes port-forwarding capabilities, as the Envoy admin interface is not exposed by default. | ||||
|
|
||||
| ```shell | ||||
| kubectl port-forward kuma-demo-app-76df4d8cf5-9q9j9 -n kuma-demo 9901:9901 2>&1 & | ||||
| ``` | ||||
|
|
||||
| Once port forwarding is set up, you can increase the log level by sending an `HTTP POST` request with one of the supported values. The debug-level logs will then be available via the standard logging facilities (for example, stderr on Kubernetes): | ||||
|
|
||||
| ```shell | ||||
| curl -X POST http://localhost:9901/logging?level=debug | ||||
| ``` | ||||
| Or targeting a particular component: | ||||
|
|
||||
| ```shell | ||||
| curl -X POST http://localhost:9901/logging?wasm=debug | ||||
| ``` | ||||
|
|
||||
| {% endtab %} | ||||
| {% tab Universal %} | ||||
|
|
||||
| In Universal mode, logging can be enabled by passing the `--envoy-log-level` flag to the kuma-dp process. | ||||
|
|
||||
| ```shell | ||||
| kuma-dp run --envoy-log-level=debug | ||||
| ``` | ||||
|
|
||||
| You can optionally target specific components, each with its own log level, by passing the flag: | ||||
| `--envoy-component-log-level` | ||||
|
|
||||
| ```shell | ||||
| kuma-dp run --envoy-component-log-level="upstream:debug,connection:trace" | ||||
| ``` | ||||
|
|
||||
| {% endtab %} | ||||
| {% endtabs %} | ||||
|
|
||||
|
|
||||
| ## Adjusting logging levels for Kuma-CP | ||||
| The available logging levels for Control Planes are: | ||||
|
|
||||
| * debug | ||||
| * info | ||||
| * off | ||||
|
|
||||
|
|
||||
| {% tabs %} | ||||
| {% tab Kubernetes %} | ||||
| When using Helm to deploy on Kubernetes, the following can be used to change the Control Plane log level: | ||||
|
|
||||
| ```yaml | ||||
| kuma: | ||||
| controlPlane: | ||||
| logLevel: "debug" | ||||
| ``` | ||||
|
|
||||
| Additionally, the --log-level flag can be passed as an argument to the kuma-cp binary in your container's definition. | ||||
|
|
||||
| ```yaml | ||||
| containers: | ||||
| - name: control-plane | ||||
| image: "docker.io/kong/kuma-cp:2.9.3" | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same suggestion applys to other code snippets underneath. |
||||
| args: | ||||
| - run | ||||
| - --log-level=debug | ||||
| - --config-file=/etc/kuma.io/kuma-control-plane/config.yaml | ||||
| ``` | ||||
|
|
||||
| {% endtab %} | ||||
| {% tab Universal %} | ||||
|
|
||||
| In Universal mode, logging can be enabled by passing the `--envoy-log-level` flag to the kuma-dp process. | ||||
|
|
||||
| ```shell | ||||
| kuma-cp run --log-level=debug | ||||
| ``` | ||||
|
|
||||
| {% endtab %} | ||||
| {% endtabs %} | ||||
|
|
||||
| ## Adjusting logging levels for CoreDNS | ||||
| Logging for CoreDNS does not have specific levels; it is either on/true or off/false. | ||||
|
|
||||
|
|
||||
| {% tabs %} | ||||
| {% tab Kubernetes %} | ||||
| When using Helm to deploy on Kubernetes, the following can be used to change the DNS log level: | ||||
|
|
||||
| ```yaml | ||||
| kuma: | ||||
| dataPlane: | ||||
| dnsLogging: true | ||||
| ``` | ||||
|
|
||||
| Additionally, the environment variable `KUMA_RUNTIME_KUBERNETES_INJECTOR_BUILTIN_DNS_LOGGING` can be set in your container's definition. | ||||
|
|
||||
| ```yaml | ||||
| containers: | ||||
| - name: control-plane | ||||
| image: "docker.io/kong/kuma-cp:2.9.3" | ||||
| env: | ||||
| - name: KUMA_RUNTIME_KUBERNETES_INJECTOR_BUILTIN_DNS_LOGGING | ||||
| value: "true" | ||||
| ``` | ||||
|
|
||||
| {% endtab %} | ||||
| {% tab Universal %} | ||||
|
|
||||
| In Universal mode, logging can be enabled by setting the environment variable `KUMA_RUNTIME_KUBERNETES_INJECTOR_BUILTIN_DNS_LOGGING`. | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Universal DPs use |
||||
|
|
||||
| ```shell | ||||
| export KUMA_RUNTIME_KUBERNETES_INJECTOR_BUILTIN_DNS_LOGGING=true | ||||
| ``` | ||||
|
|
||||
| {% endtab %} | ||||
| {% endtabs %} | ||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -263,8 +263,12 @@ def render(context) | |
| site_data = context.registers[:site].config | ||
|
|
||
| use_meshservice = @params["use_meshservice"] == "true" && Gem::Version.new(release.value.dup.sub "x", "0") >= TARGET_VERSION | ||
|
|
||
| show_tf = Gem::Version.new(release.value.dup.sub "x", "0") >= TARGET_VERSION | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change is not needed, right? |
||
|
|
||
| show_tf = Gem::Version.new(release.value.dup.sub "x", "0") >= TF_TARGET_VERSION | ||
|
|
||
|
|
||
| namespace = @params["namespace"] || site_data['mesh_namespace'] | ||
| styles = [ | ||
| { name: :uni_legacy, env: :universal, legacy_output: true }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to put it under "Using Kuma". WDYT @bartsmykla ?