Migrate the Mimir Helm chart from version 2.x to 3.0
There are breaking changes between the Grafana Mimir Helm chart versions 2.x and 3.0. Several parameters that were available in versions 2.x of the mimir-distributed Helm chart have changed.
To migrate from Helm chart 2.x to 3.0:
Understand the improvements that we made to the Mimir configuration in the Helm chart:
- The Mimir configuration is now stored in a Kubernetes ConfigMap by default, instead of a Kubernetes Secret.
- You can override individual properties without copying the entire
mimir.configblock. Specify properties you want to override under themimir.structuredConfig. - You can move secrets outside the Mimir configuration via external secrets and environment variables. Environment variables can be used to externalize secrets from the configuration file.
Decide whether or not you need to update the Mimir configuration:
If you are using external configuration (
useExternalConfig: true), then you must setconfigStorageType: Secret.Note: It is now possible to use a ConfigMap to manage your external configuration instead. If your external configuration contains secrets, then you can externalize them and use a ConfigMap. See Externalize secrets.
If you are not using external configuration (
useExternalConfig: false), and your Mimir configuration contains secrets, chose one of two options:Keep the previous location as-is by setting
configStorageType: Secret.Externalize secrets:
Move secrets from the Mimir configuration to a Kubernetes Secret.
Mount the Kubernetes Secret via
global.extraEnvFrom:global: extraEnvFrom: - secretRef: name: mysecretFor more information, see Secrets - Use case: As container environment variables.
Replace the values in the Mimir configuration with environment variables.
For example:
mimir: structuredConfig: blocks_storage: s3: secret_access_key: ${AWS_SECRET_ACCESS_KEY}
If you are not using an external configuration (
useExternalConfig: false), and your Mimir configuration does not contain secrets, then the storage location is automatically changed by Helm and you do not need to do anything.
Update your memcached configuration via your customized Helm chart values, if needed:
The mimir-distributed Helm chart supports multiple cache types. If you have not enabled any memcached caches, and you are not overriding the values of
memcached,memcached-queries,memcached-metadata, ormemcached-resultssections, then you do not need to update the memcached configuration.Otherwise, check to see if you need to change any of the following configuration parameters:
- The
memcachedsection was repurposed, andchunks-cachewas added. - The contents of the
memcachedsection now contain the following common values that are shared across all memcached instances:image,podSecurityContext, andcontainerSecurityContext. - The following sections were renamed:
memcached-queriesis nowindex-cachememcached-metadatais nowmetadata-cachememcached-resultsis nowresults-cache
- The
memcached*.replicaCountvalues were renamed:memcached.replicaCountis nowchunks-cache.replicasmemcached-queries.replicaCountis nowindex-cache.replicasmemcached-metadata.replicaCountis nowmetadata-cache.replicasmemcached-results.replicaCountis nowresults-cache.replicas
- The
memcached*.architecturevalues were removed. - The
memcached*.argumentsvalues were removed. - The default arguments are now encoded in the Helm chart templates; the values
*-cache.allocatedMemory,*-cache.maxItemMemoryand*-cache.portcontrol the arguments-m,-Iand-u. To provide additional arguments, use*-cache.extraArgs. - The
memcached*.metricsvalues were consolidated undermemcachedExporter.
See also an example of migration of customized memcached values between versions 2.x and 3.0.
- The
Update your memcached-related Mimir configuration via your customized Helm chart value that is named
mimir.config, if needed:The configuration parameters for memcached
addressesandmax_item_sizehave changed in the defaultmimir.configvalue. If you previously copied the value ofmimir.configinto your values file, then take the latest version of thememcachedconfiguration in themimir.configfrom thevalues.yamlfile in the Helm chart.(Conditional) If you have enabled
serviceMonitor, or you are overriding the value of anything under theserviceMonitorsection, or both, then move theserviceMonitorsection undermetaMonitoring.Update the
rbacsection, based on the following changes:- If you are not overriding the value of anything under the
rbacsection, then skip this step. - The
rbac.pspEnabledvalue was removed. - To continue using Pod Security Policy (PSP), set
rbac.createtotrueandrbac.typetopsp. - To start using Security Context Constraints (SCC) instead of PSP, set
rbac.createtotrueandrbac.typetoscc.
- If you are not overriding the value of anything under the
Update the
mimir.configvalue, based on the following information:- Compare your overridden value of
mimir.configwith the one in thevalues.yamlfile in the chart. If you are not overriding the value ofmimir.config, then skip this step.
- Compare your overridden value of
Decide whether or not to update the
nginxconfiguration:Unless you have overridden the value of
nginx.nginxConfig.file, and you are using the defaultmimir.config, then skip this step.Otherwise, compare the overridden
nginx.nginxConfig.filevalue to the one in thevalues.yamlfile in the Helm chart, and incorporate the differences. Pay attention to the sections that containx_scope_orgid. The value in thevalues.yamlfile contains Nginx configuration that adds theX-Scope-OrgIdheader to incoming requests that do not already set it.Note: This change allows Mimir clients to keep sending requests without needing to specify a tenant ID, even though multi-tenancy is now enabled by default.
Example of migrated values
The example values file is compatible with any 2.x version of the mimir-distributed Helm chart, and demonstrates a few things:
- All memcached caches are enabled.
- The default pod security policy is disabled.
- ServiceMonitors are enabled.
- Object storage credentials for block storage are specified directly in the
mimir.configvalue.Note
The unmodified parts of the default
mimir.configare omitted for brevity, even though in a valid 2.x values file they need to be included.
rbac:
pspEnabled: false
memcached:
enabled: true
replicaCount: 1
memcached-queries:
enabled: true
replicaCount: 1
memcached-metadata:
enabled: true
replicaCount: 1
memcached-results:
enabled: true
replicaCount: 1
serviceMonitor:
enabled: true
mimir:
config: |-
#######
# default contents omitted for brevity
#######
blocks_storage:
backend: s3
s3:
endpoint: s3.amazonaws.com
bucket_name: my-blocks-bucket
access_key_id: FAKEACCESSKEY
secret_access_key: FAKESECRETKEY
#######
# default contents omitted for brevity
#######After applying the migration steps listed in this guide, you now have a Kubernetes Secret that contains the S3 credentials, and a values file for version 3.0. The values file is does not have any omissions. The parts that were omitted in the 2.x version are automatically included by the Helm chart in version 3.0.
Kubernetes Secret:
apiVersion: v1
kind: Secret
metadata:
name: mimir-bucket-secret
data:
AWS_ACCESS_KEY_ID: FAKEACCESSKEY
AWS_SECRET_ACCESS_KEY: FAKESECRETKEYValues file:
rbac:
create: false
chunks-cache:
enabled: true
replicas: 1
index-cache:
enabled: true
replicas: 1
metadata-cache:
enabled: true
replicas: 1
results-cache:
enabled: true
replicas: 1
metaMonitoring:
serviceMonitor:
enabled: true
mimir:
structuredConfig:
blocks_storage:
backend: s3
s3:
access_key_id: ${AWS_ACCESS_KEY_ID}
bucket_name: my-blocks-bucket
endpoint: s3.amazonaws.com
secret_access_key: ${AWS_SECRET_ACCESS_KEY}
global:
extraEnvFrom:
- secretRef:
name: mimir-bucket-secretExample of migration of customized memcached values between versions 2.x and 3.0
Version 2.1:
memcached:
replicaCount: 12
arguments:
- -m 2048
- -I 128m
- -u 12345
image:
repository: memcached
tag: 1.6.9-alpine
memcached-queries:
replicaCount: 3
architecture: modern
image:
repository: memcached
tag: 1.6.9-alpineVersion 3.0:
memcached:
image:
repository: memcached
tag: 1.6.9-alpine
chunks-cache:
allocatedMemory: 2048
maxItemMemory: 128
port: 12345
replicas: 12
index-cache:
replicas: 3