Repository navigation
Description
Problem Description
devops k8s logs has no setting for the Loki address. The error text of the kubectl fallback tells the user to "Configure loki.url", but no such setting exists. devops config set loki.url <url> fails with Unknown config key: 'loki.url'. The only other address is the constant DEFAULT_LOKI_URL (http://localhost:3100) in src/devops_cli/config/defaults.py, or the option --loki-url of one command.
The spec configured-service-urls says that the service clients for Qdrant, Tempo, Pyroscope and Vault connect only to configured endpoints or ports that the CLI opened itself. Loki is not on that list. devops k8s logs dials a localhost default that nobody configured, and a user cannot fix the address in the configuration. The text of the spec k8s-logs names the same missing setting (loki.url) in four scenarios.
Reproduction Steps
- Run
devops config set loki.url http://example.com:3100. - See
Unknown config key: 'loki.url'. - Run
devops k8s logs '{app=~"x"}'while no Loki answers onlocalhost:3100. - Read the error:
The kubectl fallback supports only label="value" matchers and |= filters. Configure loki.url to evaluate this query.
Expected vs Actual Behavior
Expected: a loki.url setting exists, or the text names the real way to set the address. devops k8s logs and the MCP tool k8s_logs use the configured address, or a port-forward that the CLI opens, and stop with an error that names the setting when neither exists.
Actual: the setting does not exist. The command dials http://localhost:3100 when no --loki-url is given.
Environment Diagnostics
- DevOps CLI Version: 0.16.1 (
mainat9f6ace18) - Python Version: 3.14.10
- OS & Architecture: Linux x86_64
- Execution Environment: DevContainer
Logs, Traces, or Terminal Output
$ devops config set loki.url http://example.com:3100
Unknown config key: 'loki.url'
Known keys with a similar name: valkey.url
Related: #2635 removes the loki_url option from the MCP tool k8s_logs. That fix leaves the default address as it is, and this issue covers the missing setting.
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Proposed design
Problem statement
The command devops k8s logs tells a user to configure loki.url, but that key does not exist in the config system. The command dials the constant DEFAULT_LOKI_URL (http://localhost:3100) when no --loki-url flag is given. A user cannot set the Loki address in the configuration. The spec k8s-logs names loki.url in four scenarios, and the spec configured-service-urls lists Qdrant, Tempo, Pyroscope and Vault but not Loki. The fix adds the missing loki.url key so the command and the MCP tool k8s_logs read the configured address.
Acceptance criteria
Requirement: loki-url-config-key
The config system SHALL recognize loki.url as a valid key.
Scenario: set-loki-url-succeeds
- WHEN A user runs
devops config set loki.url http://example.com:3100 - THEN The command exits with code 0 and does not print
Unknown config key
Requirement: k8s-logs-uses-configured-address
The command devops k8s logs SHALL connect to the address in the loki.url setting when no --loki-url flag is given.
Scenario: configured-address-is-used
- WHEN
loki.urlis set tohttp://example.com:3100anddevops k8s logs '{app=~"x"}'is run without--loki-url - THEN The HTTP request is sent to
http://example.com:3100/loki/api/v1/query_range
Requirement: error-names-real-setting
The kubectl fallback error text SHALL name loki.url as the setting to configure.
Scenario: fallback-error-names-loki-url
- WHEN The kubectl fallback triggers because no Loki answers on the configured or default address
- THEN The error text contains the string
loki.url
Requirement: mcp-tool-uses-configured-address
The MCP tool k8s_logs SHALL connect to the address in the loki.url setting.
Scenario: mcp-uses-configured-address
- WHEN
loki.urlis set tohttp://example.com:3100and the MCP toolk8s_logsis called with no URL argument - THEN The HTTP request is sent to
http://example.com:3100/loki/api/v1/query_range
Requirement: default-unchanged
When loki.url is not set, the command SHALL use DEFAULT_LOKI_URL.
Scenario: default-address-when-unset
- WHEN
loki.urlis not set anddevops k8s logsis run without--loki-url - THEN The HTTP request is sent to
http://localhost:3100/loki/api/v1/query_range
Existing Tool Considered
No check has run. The need is to add one configuration key to the project's own config system and wire it into two existing call sites. No external tool or library covers this. The project builds and keeps its own config layer in src/devops_cli/config/. The written cost is the tokens to add the key to settings.py, update the two call sites in k8s/logql.py and the MCP tool, update the error text, and add tests, plus the time to keep the key in sync with the spec and the defaults file.
Key questions
- What is the config key name?:
loki.url, matching the existing pattern ofqdrant.url,tempo.url,valkey.urland the text in the speck8s-logsand the error message. (best practice) [sources: src/devops_cli/config/defaults.py, openspec/changes/archive/2026-10-29-2635-k8s-logs-mcp-no-loki-url/proposal.md]- Chosen: loki.url. Matches the existing
.urlpattern and the spec text that names this key in four scenarios. - Rejected: loki_url. Does not match the dot-separated pattern used by every other service URL key.
- Chosen: loki.url. Matches the existing
- What is the default value when the key is not set?:
http://localhost:3100, the existing constantDEFAULT_LOKI_URL. [sources: src/devops_cli/config/defaults.py:234] - Where is the key registered?: In
src/devops_cli/config/settings.py, alongside the other service URL keys such asqdrant.urlandtempo.url. (best practice) [sources: src/devops_cli/config/settings.py, openspec/changes/archive/2026-10-29-2635-k8s-logs-mcp-no-loki-url/proposal.md]- Chosen: settings.py alongside other service URL keys. Every other service URL key is registered there. The archived fix(k8s): a loki url that the mcp tool k8s_logs gets from the model reaches private addresses and returns the answer #2635 change confirms
settings.pyhas no Loki key. - Rejected: A new file for Loki. Adds a file for one key and breaks the single-file pattern of the config layer.
- Chosen: settings.py alongside other service URL keys. Every other service URL key is registered there. The archived fix(k8s): a loki url that the mcp tool k8s_logs gets from the model reaches private addresses and returns the answer #2635 change confirms
- Does the MCP tool
k8s_logsread the setting?: Yes. The issue states the MCP tool SHALL use the configured address. The archived fix(k8s): a loki url that the mcp tool k8s_logs gets from the model reaches private addresses and returns the answer #2635 change removed theloki_urloption from the tool, so the setting is the only address source besides the default. (best practice) [sources: openspec/changes/archive/2026-10-29-2635-k8s-logs-mcp-no-loki-url/design.md, openspec/changes/archive/2026-10-29-2635-k8s-logs-mcp-no-loki-url/proposal.md]- Chosen: Read the setting in the MCP tool. The issue's expected behavior names both the command and the MCP tool. The tool already has no URL option after fix(k8s): a loki url that the mcp tool k8s_logs gets from the model reaches private addresses and returns the answer #2635.
- Rejected: Leave the MCP tool on the constant only. Contradicts the issue's expected behavior and leaves the tool unable to reach a non-localhost Loki.
- Does the
--loki-urlflag still override the setting?: Yes. The flag is an explicit per-invocation override. The setting is the persistent default. The flag takes precedence when both are present. (best practice) [sources: src/devops_cli/k8s/logql.py]- Chosen: Flag overrides setting. Standard CLI convention: an explicit flag wins over a stored default. The existing code already gives the flag priority over the constant.
- Rejected: Setting overrides flag. Breaks the expectation that a flag given on the command line is the most specific instruction.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The error message names a config key that does not exist and the command dials a hardcoded localhost default that users cannot override via config.The command still works with the --loki-url flag, but the config path is broken and the error text misleads users.Users who set Loki through config cannot do so and the error text points to a non-existent key.The fix is to add one config key and wire it into the default, or to correct the error text to name the real option.Both items deal with the Loki address in k8s logs, but #2635 removes the SSRF vector from the MCP tool while this candidate adds a missing config setting or fixes the error text.fix(k8s): the MCP tool k8s_logs takes no Loki URL (#2668)
devops-cli-service commentedon Oct 30, 2026
Status set to Ready at 0b7e190 (see proposed design in issue body).
devops-cli-service commentedon Nov 2, 2026
Staged: branch
fix/2651-devops-k8s-logs-names-a-loki, draft pull request #3151. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
docs(openspec): fix the plan of #2651
docs(openspec): plan #2651 Add loki.url config key for k8s logs (#3151)
30 remaining items
devops-cli-service commentedon Nov 4, 2026
The runner Job devops-cli-runner-20261104-200132-6b9b ended: succeeded.
Image digest: sha256:eb2c32f9c27c350eafb35b7f08c274621a0a05b95904b2185c667b9805b0d499
The last lines of its log:
devops-cli-service commentedon Nov 4, 2026
Cleared the stop at group 1 by the rule
digest: the runner image changed since the stop, from sha256:eb2c32f9c27c350eafb35b7f08c274621a0a05b95904b2185c667b9805b0d499 to sha256:ff7f81f8f5902c5ae4e48ed334bc83f842b51afb639ab71be65cb4240daadf01. The item is Planned again, and the Service takes it in the next round. The Service clears a stop one time for each runner image. A new stop on this image waits for a commentimplement: retry.[-]fix(k8s): devops k8s logs names a loki.url setting that does not exist and dials a localhost default[/-][+]fix(k8s): Add loki.url config key for k8s logs[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 90 characters, and the limit is 60. The type and the scope stay.
fix(k8s): devops k8s logs names a loki.url setting that does not exist and dials a localhost defaultfix(k8s): Add loki.url config key for k8s logsdevops-cli-service commentedon Nov 6, 2026
Released in v0.70.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.70.0
devops-cli-service commentedon Nov 6, 2026
Live since 2026-11-06 16:15 UTC