From 0fb6e86343dce327ee1133ba748e12e63f346c5c Mon Sep 17 00:00:00 2001 From: Matt Bolt Date: Tue, 29 Sep 2020 17:07:23 -0400 Subject: [PATCH 1/3] Upgrade Thanos to 0.15.0 --- cost-analyzer/charts/thanos/Chart.yaml | 4 +- .../templates/query-frontend-deployment.yaml | 120 ++++++++++ ...uery-frontend-horizontalpodautoscaler.yaml | 35 +++ .../templates/query-frontend-ingress.yml | 45 ++++ .../query-frontend-poddisruptionbudget.yaml | 25 ++ .../templates/query-frontend-service.yaml | 32 +++ .../query-frontend-servicemonitor.yaml | 30 +++ cost-analyzer/charts/thanos/values.yaml | 217 +++++++++++++++--- .../cost-analyzer-deployment-template.yaml | 4 +- cost-analyzer/values-thanos.yaml | 34 ++- cost-analyzer/values.yaml | 4 +- 11 files changed, 508 insertions(+), 42 deletions(-) create mode 100644 cost-analyzer/charts/thanos/templates/query-frontend-deployment.yaml create mode 100644 cost-analyzer/charts/thanos/templates/query-frontend-horizontalpodautoscaler.yaml create mode 100644 cost-analyzer/charts/thanos/templates/query-frontend-ingress.yml create mode 100644 cost-analyzer/charts/thanos/templates/query-frontend-poddisruptionbudget.yaml create mode 100644 cost-analyzer/charts/thanos/templates/query-frontend-service.yaml create mode 100644 cost-analyzer/charts/thanos/templates/query-frontend-servicemonitor.yaml diff --git a/cost-analyzer/charts/thanos/Chart.yaml b/cost-analyzer/charts/thanos/Chart.yaml index b3336db28..f8893a2cd 100644 --- a/cost-analyzer/charts/thanos/Chart.yaml +++ b/cost-analyzer/charts/thanos/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -appVersion: 0.12.2 +appVersion: 0.15.0 description: Thanos is a set of components that can be composed into a highly available metric system with unlimited storage capacity, which can be added seamlessly on top of existing Prometheus deployments. name: thanos keywords: @@ -9,7 +9,7 @@ keywords: sources: - https://github.com/thanos-io/thanos - https://github.com/banzaicloud/banzai-charts/tree/master/thanos -version: 0.12.2 +version: 0.15.0 icon: https://raw.githubusercontent.com/thanos-io/thanos/master/website/static/Thanos-logo_full.svg maintainers: - name: Banzai Cloud diff --git a/cost-analyzer/charts/thanos/templates/query-frontend-deployment.yaml b/cost-analyzer/charts/thanos/templates/query-frontend-deployment.yaml new file mode 100644 index 000000000..7b2719b93 --- /dev/null +++ b/cost-analyzer/charts/thanos/templates/query-frontend-deployment.yaml @@ -0,0 +1,120 @@ +{{ if .Values.queryFrontend.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "thanos.componentname" (list $ "query-frontend") }} + labels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + helm.sh/chart: {{ include "thanos.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + app.kubernetes.io/component: query-frontend +{{ with .Values.queryFrontend.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }} + {{- with .Values.queryFrontend.deploymentAnnotations }} + annotations: {{ toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if not .Values.queryFrontend.autoscaling.enabled }} + replicas: {{ .Values.queryFrontend.replicaCount | default 1 }} +{{- end }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: query-frontend +{{ with .Values.queryFrontend.deploymentMatchLabels }}{{ toYaml . | indent 6 }}{{ end }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: query-frontend +{{ with .Values.queryFrontend.labels }}{{ toYaml . | indent 8 }}{{ end }} + {{- with .Values.queryFrontend.annotations }} + annotations: {{ toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.queryFrontend.metrics.annotations.enabled }} + prometheus.io/scrape: "true" + prometheus.io/port: "{{ .Values.queryFrontend.http.port }}" + {{- end }} + spec: + containers: + - name: thanos-query-frontend + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - "query-frontend" + - "--log.level={{ .Values.queryFrontend.logLevel }}" + - "--http-address=0.0.0.0:{{ .Values.queryFrontend.http.port }}" + - "--query-frontend.downstream-url=http://{{ .Release.Name }}-thanos-query-http.{{ .Release.Namespace }}:{{ .Values.query.http.port }}" + - "--query-range.split-interval={{ .Values.queryFrontend.splitInterval }}" + - "--query-range.max-retries-per-request={{ .Values.queryFrontend.maxRetriesPerRequest }}" + - "--query-range.max-query-length={{ .Values.queryFrontend.maxQueryLength }}" + - "--query-range.max-query-parallelism={{ .Values.queryFrontend.maxQueryParallelism }}" + - "--query-range.response-cache-max-freshness={{ .Values.queryFrontend.responseCacheMaxFreshness }}" + {{- if .Values.queryFrontend.responseCache.enabled }} + {{- with .Values.queryFrontend.responseCache }} + - |- + --query-range.response-cache-config= + config: + max_size: {{ quote .maxSize }} + max_size_items: {{ .maxSizeItems }} + validity: {{ quote .validity }} + type: "in-memory" + {{- end }} + {{- else if .Values.queryFrontend.responseCacheConfigFile }} + - "--query-range.response-cache-config-file={{ .Values.queryFrontend.responseCacheConfigFile }}" + {{- else if .Values.queryFrontend.responseCacheConfig }} + - |- + --query-range.response-cache-config={{ toYaml .Values.queryFrontend.responseCacheConfig | nindent 12 }} + {{- end }} + {{- if .Values.queryFrontend.compressResponses }} + - "--query-frontend.compress-responses" + {{- end }} + {{- if .Values.queryFrontend.partialResponse }} + - "--query-range.partial-response" + {{- end }} + {{- if .Values.queryFrontend.extraArgs }} + {{ toYaml .Values.queryFrontend.extraArgs | nindent 8 }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.queryFrontend.http.port }} + resources: + {{ toYaml .Values.queryFrontend.resources | nindent 10 }} + env: + {{- toYaml .Values.queryFrontend.extraEnv | nindent 10 }} + volumeMounts: + {{- if .Values.queryFrontend.certSecretName }} + - mountPath: /etc/certs + name: {{ .Values.queryFrontend.certSecretName }} + readOnly: true + {{- end }} + livenessProbe: + httpGet: + path: /-/healthy + port: http + volumes: + {{- if .Values.queryFrontend.certSecretName }} + - name: {{ .Values.queryFrontend.certSecretName }} + secret: + defaultMode: 420 + secretName: {{ .Values.queryFrontend.certSecretName }} + {{- end }} + {{- with .Values.queryFrontend.securityContext }} + securityContext: {{ toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.queryFrontend.nodeSelector }} + nodeSelector: {{ toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.queryFrontend.affinity }} + affinity: {{ toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.queryFrontend.tolerations }} + tolerations: {{ toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.queryFrontend.serviceAccount }} + serviceAccountName: "{{ . }}" + {{- end }} +{{ end }} diff --git a/cost-analyzer/charts/thanos/templates/query-frontend-horizontalpodautoscaler.yaml b/cost-analyzer/charts/thanos/templates/query-frontend-horizontalpodautoscaler.yaml new file mode 100644 index 000000000..82d1ba650 --- /dev/null +++ b/cost-analyzer/charts/thanos/templates/query-frontend-horizontalpodautoscaler.yaml @@ -0,0 +1,35 @@ +{{- if .Values.queryFrontend.enabled }} +{{- if .Values.queryFrontend.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "thanos.componentname" (list $ "query-frontend") }} + labels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + helm.sh/chart: {{ include "thanos.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + app.kubernetes.io/component: query-frontend +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "thanos.componentname" (list $ "query-frontend") }} + minReplicas: {{ .Values.queryFrontend.autoscaling.minReplicas }} + maxReplicas: {{ .Values.queryFrontend.autoscaling.maxReplicas }} + metrics: +{{- with .Values.queryFrontend.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ . }} +{{- end }} +{{- with .Values.queryFrontend.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ . }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/cost-analyzer/charts/thanos/templates/query-frontend-ingress.yml b/cost-analyzer/charts/thanos/templates/query-frontend-ingress.yml new file mode 100644 index 000000000..a34cd15fe --- /dev/null +++ b/cost-analyzer/charts/thanos/templates/query-frontend-ingress.yml @@ -0,0 +1,45 @@ +--- +{{- if and .Values.queryFrontend.enabled .Values.queryFrontend.http.ingress.enabled }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ include "thanos.componentname" (list $ "query-frontend") }}-http + labels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + helm.sh/chart: {{ include "thanos.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + app.kubernetes.io/component: query-frontend + {{- if .Values.queryFrontend.http.ingress.labels }} + {{ toYaml .Values.queryFrontend.http.ingress.labels | indent 4 }} + {{- end }} + {{- with .Values.queryFrontend.http.ingress.annotations }} + annotations: {{ toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.queryFrontend.http.ingress.tls }} + tls: + {{- range .Values.queryFrontend.http.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + {{- if .secretName }} + secretName: {{ .secretName }} + {{- end}} + {{- end }} + {{- end }} + rules: + {{- range .Values.queryFrontend.http.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $.Values.queryFrontend.http.ingress.path }} + backend: + serviceName: {{ include "thanos.componentname" (list $ "query-frontend") }}-http + servicePort: {{ $.Values.queryFrontend.http.port }} + {{- end }} +{{- end }} + + diff --git a/cost-analyzer/charts/thanos/templates/query-frontend-poddisruptionbudget.yaml b/cost-analyzer/charts/thanos/templates/query-frontend-poddisruptionbudget.yaml new file mode 100644 index 000000000..ed0c1cd9e --- /dev/null +++ b/cost-analyzer/charts/thanos/templates/query-frontend-poddisruptionbudget.yaml @@ -0,0 +1,25 @@ +{{- if and .Values.queryFrontend.enabled .Values.queryFrontend.podDisruptionBudget.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ include "thanos.componentname" (list $ "query-frontend") }} + labels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + helm.sh/chart: {{ include "thanos.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} + app.kubernetes.io/component: query-frontend +{{ with .Values.queryFrontend.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }} +spec: + {{- if .Values.queryFrontend.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.queryFrontend.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.queryFrontend.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.queryFrontend.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + app.kubernetes.io/component: query-frontend +{{- end }} \ No newline at end of file diff --git a/cost-analyzer/charts/thanos/templates/query-frontend-service.yaml b/cost-analyzer/charts/thanos/templates/query-frontend-service.yaml new file mode 100644 index 000000000..5d5223877 --- /dev/null +++ b/cost-analyzer/charts/thanos/templates/query-frontend-service.yaml @@ -0,0 +1,32 @@ +{{- if .Values.queryFrontend.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "thanos.componentname" (list $ "query-frontend") }}-http + {{- with .Values.queryFrontend.http.service.annotations }} + annotations: {{ toYaml .| nindent 4 }} + {{- end }} + labels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + helm.sh/chart: {{ include "thanos.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} + app.kubernetes.io/component: query-frontend +{{ with .Values.queryFrontend.http.service.labels }}{{ toYaml . | indent 4 }}{{ end }} +spec: + type: {{ .Values.queryFrontend.http.service.type }} + {{- if .Values.queryFrontend.http.service.externalTrafficPolicy }} + externalTrafficPolicy: {{ .Values.queryFrontend.http.externalTrafficPolicy }} + {{- end }} + ports: + - port: {{ .Values.queryFrontend.http.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "thanos.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: query-frontend +{{ with .Values.queryFrontend.http.service.matchLabels }}{{ toYaml . | indent 4 }}{{ end }} +{{- end -}} diff --git a/cost-analyzer/charts/thanos/templates/query-frontend-servicemonitor.yaml b/cost-analyzer/charts/thanos/templates/query-frontend-servicemonitor.yaml new file mode 100644 index 000000000..b7a1b4ddb --- /dev/null +++ b/cost-analyzer/charts/thanos/templates/query-frontend-servicemonitor.yaml @@ -0,0 +1,30 @@ +{{- if and .Values.queryFrontend.enabled .Values.queryFrontend.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "thanos.componentname" (list $ "query-frontend") }} + labels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + helm.sh/chart: {{ include "thanos.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + app.kubernetes.io/component: query-frontend +{{ with .Values.queryFrontend.metrics.serviceMonitor.labels }}{{ toYaml . | indent 4 }}{{ end }} +spec: + jobLabel: thanos-query + selector: + matchLabels: + app.kubernetes.io/name: {{ include "thanos.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: query-frontend + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + endpoints: + - port: http + interval: {{ .Values.queryFrontend.metrics.serviceMonitor.interval | default "15s" }} + {{- with .Values.queryFrontend.metrics.serviceMonitor.relabellings }} + metricRelabelings: {{ toYaml . | nindent 8 }} + {{- end }} +{{- end -}} diff --git a/cost-analyzer/charts/thanos/values.yaml b/cost-analyzer/charts/thanos/values.yaml index 8cf39aab9..22d73479f 100644 --- a/cost-analyzer/charts/thanos/values.yaml +++ b/cost-analyzer/charts/thanos/values.yaml @@ -1,6 +1,6 @@ image: repository: thanosio/thanos - tag: v0.12.2 + tag: v0.15.0 pullPolicy: IfNotPresent store: @@ -140,6 +140,157 @@ store: affinity: {} serviceAccount: "" +# Query Frontend Component +queryFrontend: + enabled: true + + # Split queries by an interval and execute in parallel, 0 disables it. + splitInterval: 24h + + # Maximum number of retries for a single request; beyond this, the downstream error is returned. + maxRetriesPerRequest: 5 + + # Limit the query time range (end - start time) in the query-frontend, 0 disables it. + maxQueryLength: 0 + + # Maximum number of queries will be scheduled in parallel by the frontend.\ + maxQueryParallelism: 14 + + # Most recent allowed cacheable result, to prevent caching very recent results that might still be in flux. + responseCacheMaxFreshness: 1m + + # Path to YAML file that contains response cache configuration. + # responseCacheConfigFile: + + # Response Cache Configuration + responseCache: + enabled: false + maxSize: 512MB + maxSizeItems: 0 + validity: 10m + + # Response cache configuration content + # responseCacheConfig: + + # Enable partial response for queries if no partial_response param is specified. --no-query-range.partial-response for disabling. + # partialResponse: false + + # Compress HTTP responses. + compressResponses: true + + logLevel: info + # Add extra environment variables to query + extraEnv: [] + # - name: ENV + # value: value + # + # Add extra arguments to the query service + extraArgs: [] + # - "--extraargs=extravalue" + # + # Number of replicas running from query component + replicaCount: 1 + # Enable HPA for query component + autoscaling: + enabled: false + minReplicas: 2 + maxReplicas: 3 + targetCPUUtilizationPercentage: 50 + targetMemoryUtilizationPercentage: 50 + # Enable podDisruptionBudget for query component + podDisruptionBudget: + enabled: false + # minAvailable and maxUnavailable can't be used simultaneous. Choose one. + minAvailable: 1 + # maxUnavailable: 50% + + serviceAccount: "" + + # The http endpoint to communicate with other components + http: + # http listen port number + port: 10902 + # Service definition for query http service + service: + type: ClusterIP + # Annotations to query http service + annotations: {} + # Labels to query http service + labels: {} + matchLabels: {} + # Set up ingress for the http service + ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + labels: {} + path: "/" + hosts: + - "/" + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + + certSecretName: "" + # Extra labels for query pod template + labels: {} + # cluster: example + # + # Extra annotations for query pod template + annotations: {} + # example.com: default + # + # Add extra labels to query deployment + deploymentLabels: {} + # extraLabel: extraLabelValue + # + # Add extra annotations to query deployment + deploymentAnnotations: {} + # extraAnnotation: extraAnnotationValue + # + # Add extra selector matchLabels to query deployment + deploymentMatchLabels: {} + + # Enable metrics collecting for query service + metrics: + # This is the Prometheus annotation type scraping configuration + annotations: + enabled: false + # Enable ServiceMonitor https://github.com/coreos/prometheus-operator + serviceMonitor: + enabled: false + # Labels for prometheus-operator to find servicemonitor + labels: {} + + # Optional securityContext + securityContext: {} + resources: {} + # limits: + # cpu: 2000m + # memory: 16Gi + # requests: + # cpu: 1000m + # memory: 4Gi + # + # Node tolerations for server scheduling to nodes with taints + # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + tolerations: [] + # - key: "key" + # operator: "Equal|Exists" + # value: "value" + # effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" + # + # Node labels for compact pod assignment + # Ref: https://kubernetes.io/docs/user-guide/node-selection/ + # + nodeSelector: {} + # + # Pod affinity + # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity + affinity: {} + query: enabled: true # Label to treat as a replica indicator along which data is deduplicated. @@ -163,9 +314,10 @@ query: webPrefixHeader: "" # Maximum time to process query by query node. timeout: 2m - # Maximum number of queries processed - # concurrently by query node. - maxConcurrent: 20 + # Maximum number of queries processed concurrently by query node. + maxConcurrent: 16 + # Maximum number of select requests made concurrently per a query. + maxConcurrentSelect: 4 # Enable automatic adjustment (step / 5) to what source of data should be used in store gateways # if no max_source_resolution param is specified. autoDownsampling: false @@ -213,33 +365,6 @@ query: minAvailable: 1 # maxUnavailable: 50% - # The grpc endpoint to communicate with other components - grpc: - # grpc listen port number - port: 10901 - # Service definition for query grpc service - service: - # Annotations to query grpc service - annotations: {} - # labels to query grpc service - labels: {} - matchLabels: {} - # Set up ingress for the grpc service - ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - labels: {} - path: "/" - hosts: - - "/" - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - serviceAccount: "" - # The http endpoint to communicate with other components http: # http listen port number @@ -286,9 +411,8 @@ query: # # Add extra selector matchLabels to query deployment deploymentMatchLabels: {} - # Enable metrics collecting for query service - + # Enable metrics collecting for query service metrics: # This is the Prometheus annotation type scraping configuration annotations: @@ -326,6 +450,33 @@ query: # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity affinity: {} + # The grpc endpoint to communicate with other components + grpc: + # grpc listen port number + port: 10901 + # Service definition for query grpc service + service: + # Annotations to query grpc service + annotations: {} + # labels to query grpc service + labels: {} + matchLabels: {} + # Set up ingress for the grpc service + ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + labels: {} + path: "/" + hosts: + - "/" + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + serviceAccount: "" + compact: enabled: true # Minimum age of fresh (non-compacted) blocks before they are being processed. diff --git a/cost-analyzer/templates/cost-analyzer-deployment-template.yaml b/cost-analyzer/templates/cost-analyzer-deployment-template.yaml index 71146fabf..eec1d15e0 100755 --- a/cost-analyzer/templates/cost-analyzer-deployment-template.yaml +++ b/cost-analyzer/templates/cost-analyzer-deployment-template.yaml @@ -373,7 +373,7 @@ spec: - name: THANOS_ENABLED value: "true" - name: THANOS_QUERY_URL - value: http://{{ .Release.Name }}-thanos-query-http.{{ .Release.Namespace }}:{{ .Values.thanos.query.http.port }} + value: http://{{ .Release.Name }}-thanos-query-frontend-http.{{ .Release.Namespace }}:{{ .Values.thanos.queryFrontend.http.port }} - name: THANOS_QUERY_OFFSET value: {{ .Values.global.thanos.queryOffset | default "3h" }} {{- end }} @@ -523,7 +523,7 @@ spec: - name: THANOS_ENABLED value: "true" - name: THANOS_QUERY_URL - value: http://{{ .Release.Name }}-thanos-query-http.{{ .Release.Namespace }}:{{ .Values.thanos.query.http.port }} + value: http://{{ .Release.Name }}-thanos-query-frontend-http.{{ .Release.Namespace }}:{{ .Values.thanos.queryFrontend.http.port }} - name: THANOS_QUERY_OFFSET value: {{ .Values.global.thanos.queryOffset | default "3h" }} {{- end }} diff --git a/cost-analyzer/values-thanos.yaml b/cost-analyzer/values-thanos.yaml index b6007bca6..c770f6691 100644 --- a/cost-analyzer/values-thanos.yaml +++ b/cost-analyzer/values-thanos.yaml @@ -2,6 +2,12 @@ global: thanos: enabled: true +# For Thanos Installs, Allow Higher Concurrency from Cost-Model +# Still may require tweaking for some installs, but the thanos-query-frontend +# will greatly assist in reduction memory bloat in query. +kubecostModel: + maxQueryConcurrency: 10 + prometheus: server: extraArgs: @@ -16,7 +22,7 @@ prometheus: enableAdminApi: true sidecarContainers: - name: thanos-sidecar - image: thanosio/thanos:v0.12.2 + image: thanosio/thanos:v0.15.0 args: - sidecar - --log.level=debug @@ -62,7 +68,10 @@ thanos: query: enabled: true timeout: 3m - maxConcurrent: 1 + # Maximum number of queries processed concurrently by query node. + maxConcurrent: 16 + # Maximum number of select requests made concurrently per a query. + maxConcurrentSelect: 4 resources: requests: memory: "2.5Gi" @@ -70,11 +79,30 @@ thanos: extraEnv: - name: GOGC value: "100" + + # Thanos Query Frontend + queryFrontend: + enabled: true + compressResponses: true + # Response Cache Configuration + # Configure either a max size constraint or max items. + responseCache: + enabled: true + # Maximum memory size of the cache in bytes. A unit suffix (KB, MB, GB) may be applied. + maxSize: 1.25GB + # Maximum number of entries in the cache. + maxSizeItems: 0 + # The expiry duration for the cache. + validity: 2m + resources: + requests: + memory: "1.5Gi" + # Thanos Sidecar Service Discovery sidecar: enabled: true bucket: - enabled: true + enabled: false compact: enabled: true dataVolume: diff --git a/cost-analyzer/values.yaml b/cost-analyzer/values.yaml index 2095b9f55..8a7c4c15e 100755 --- a/cost-analyzer/values.yaml +++ b/cost-analyzer/values.yaml @@ -10,7 +10,7 @@ global: # Durable storage option, product key required thanos: enabled: false - # queryService: http://kubecost-thanos-query-http.kubecost:{{ .Values.thanos.query.http.port }} # an address of the thanos query endpoint, if different from installed thanos + # queryService: http://thanos-query-frontend-http.kubecost:{{ .Values.thanos.queryFrontend.http.port }} # an address of the thanos query-frontend endpoint, if different from installed thanos # queryServiceBasicAuthSecretName: mcdbsecret # kubectl create secret generic mcdbsecret -n kubecost --from-file=USERNAME --from-file=PASSWORD <---enter basic auth credentials like that # queryServiceBearerTokenSecretName mcdbsecret # kubectl create secret generic mcdbsecret -n kubecost --from-file=TOKEN # queryOffset: 3h # The offset to apply to all thanos queries in order to achieve syncronization on all cluster block stores @@ -100,7 +100,7 @@ kubecostModel: warmCache: true warmSavingsCache: true etl: true - maxQueryConcurrency: 5 + maxQueryConcurrency: 10 # utcOffset represents a timezone in hours and minutes east (+) or west (-) # of UTC, itself, which is defined as +00:00. # See the tz database of timezones to look up your local UTC offset: From d913c7ab476176793f2625636bc698ca3fd6785d Mon Sep 17 00:00:00 2001 From: Matt Bolt Date: Tue, 29 Sep 2020 17:11:40 -0400 Subject: [PATCH 2/3] Reset the default cost-model concurrency to 5 --- cost-analyzer/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cost-analyzer/values.yaml b/cost-analyzer/values.yaml index 8a7c4c15e..576721506 100755 --- a/cost-analyzer/values.yaml +++ b/cost-analyzer/values.yaml @@ -100,7 +100,7 @@ kubecostModel: warmCache: true warmSavingsCache: true etl: true - maxQueryConcurrency: 10 + maxQueryConcurrency: 5 # utcOffset represents a timezone in hours and minutes east (+) or west (-) # of UTC, itself, which is defined as +00:00. # See the tz database of timezones to look up your local UTC offset: From a8f508387e933e8f21431e479a8e89b6827d2869 Mon Sep 17 00:00:00 2001 From: Matt Bolt Date: Tue, 29 Sep 2020 19:13:22 -0400 Subject: [PATCH 3/3] Halve the concurrency --- cost-analyzer/values-thanos.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cost-analyzer/values-thanos.yaml b/cost-analyzer/values-thanos.yaml index c770f6691..90e7c4633 100644 --- a/cost-analyzer/values-thanos.yaml +++ b/cost-analyzer/values-thanos.yaml @@ -6,7 +6,7 @@ global: # Still may require tweaking for some installs, but the thanos-query-frontend # will greatly assist in reduction memory bloat in query. kubecostModel: - maxQueryConcurrency: 10 + maxQueryConcurrency: 5 prometheus: server: @@ -69,9 +69,9 @@ thanos: enabled: true timeout: 3m # Maximum number of queries processed concurrently by query node. - maxConcurrent: 16 + maxConcurrent: 8 # Maximum number of select requests made concurrently per a query. - maxConcurrentSelect: 4 + maxConcurrentSelect: 2 resources: requests: memory: "2.5Gi"