Skip to content
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

fix query-frontend request load balancing when using k8s service #7966

Merged
merged 3 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* [7880](https://github.com/grafana/loki/pull/7880) **sandeepsukhani**: consider range and offset in queries while looking for schema config for query sharding.
* [7937](https://github.com/grafana/loki/pull/7937) **ssncferreira**: Deprecate CLI flag `-ruler.wal-cleaer.period` and replace it with `-ruler.wal-cleaner.period`.
* [7906](https://github.com/grafana/loki/pull/7906) **kavirajk**: Add API endpoint that formats LogQL expressions and support new `fmt` subcommand in `logcli` to format LogQL query.
* [7966](https://github.com/grafana/loki/pull/7966) **sandeepsukhani**: Fix query-frontend request load balancing when using k8s service.

##### Changes

Expand Down
11 changes: 9 additions & 2 deletions production/ksonnet/loki/query-frontend.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ local k = import 'ksonnet-util/kausal.libsonnet';

local service = k.core.v1.service,

query_frontend_service:
// A headless service for discovering IPs of each query-frontend pod.
// It leaves it up to the client to do any load-balancing of requests,
// so if the intention is to use the k8s service for load balancing,
// it is advised to use the below `query-frontend` service instead.
query_frontend_headless_service:
$.util.grpclbServiceFor($.query_frontend_deployment) +
// Make sure that query frontend worker, running in the querier, do resolve
// each query-frontend pod IP and NOT the service IP. To make it, we do NOT
Expand All @@ -52,6 +56,9 @@ local k = import 'ksonnet-util/kausal.libsonnet';
// Query frontend will not become ready until at least one querier connects
// which creates a chicken and egg scenario if we don't publish the
// query-frontend address before it's ready.
service.mixin.spec.withPublishNotReadyAddresses(true),
service.mixin.spec.withPublishNotReadyAddresses(true) +
service.mixin.metadata.withName('query-frontend-headless'),

query_frontend_service:
k.util.serviceFor($.query_frontend_deployment, $._config.service_ignored_labels),
}
2 changes: 1 addition & 1 deletion production/ksonnet/loki/query-scheduler.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local k = import 'ksonnet-util/kausal.libsonnet';
max_outstanding_per_tenant: max_outstanding,
},
frontend_worker+: {
frontend_address: 'query-frontend.%s.svc.cluster.local.:9095' % $._config.namespace,
frontend_address: 'query-frontend-headless.%s.svc.cluster.local.:9095' % $._config.namespace,
},
},
},
Expand Down