Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agardnerit/kubectl-otel
Trace kubectl commands using OpenTelemetry
https://github.com/agardnerit/kubectl-otel
Last synced: 27 days ago
JSON representation
Trace kubectl commands using OpenTelemetry
- Host: GitHub
- URL: https://github.com/agardnerit/kubectl-otel
- Owner: agardnerIT
- License: apache-2.0
- Created: 2023-08-04T22:06:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-11T05:50:32.000Z (11 months ago)
- Last Synced: 2024-02-11T06:27:47.243Z (11 months ago)
- Language: Shell
- Size: 52.7 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trace kubectl with OpenTelemetry
![kubectl apply](assets/kubectl-otel-apply-deploy.png)
kubectl plugin to generate OpenTelemetry traces for kubectl commands.
```
kubectl otel
```For example:
```
kubectl otel apply -f deployment.yaml
```This can be aliased to make it more automated:
```
alias ko='kubectl otel'
ko apply -f deployment.yaml
```## Prerequisites
- Currently only supports Linux and MacOS
- You must have [a standalone binary of tracepusher in your path](https://github.com/agardnerIT/tracepusher/releases/latest) (ie. you are able to run `tracepusher` from the command line and see output)
- You must have an OpenTelemetry collector somewhere so the spans can be sent there## Installation
krew listing - coming soon
For now:
- Download [kubectl-otel](kubectl-otel)
- Make it executable: `chmod +x kubectl-otel`
- Move it to anywhere in your path (eg. `/usr/local/bin`): `sudo mv kubectl-otel /usr/local/bin`
- Try it out: `kubectl otel version` should execute `kubectl version` and trace the time (expected to be quick eg. 0 seconds)## Defaults and Configuration
The plugin assumes the following:
- The OTEL collector URL defaults to `http://localhost:4318`
- The span service name defaults to `kubectl`Use environment variable: `KP_OTELCOL_ENDPOINT` to specify your collector endpoint
Use environment variable: `KP_SERVICE_NAME` to specify a different service name
```
export KP_OTEL_ENDPOINT=http://otelcol.somewhere.com:4318
export KP_OTEL_ENDPOINT=kubectl-dev
kubectl otel apply -f deployment.yaml
```