Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Migrate to the unified gateway deployment for NGINX and GEM gateway in Helm
Version 4.0.0 of the mimir-distributed Helm chart adds a new way to deploy the NGINX reverse proxy in front of
Mimir. The NGINX configuration was unified with the GEM (Grafana Enterprise Metrics) gateway configuration. Using a
single section makes it possible to migrate from Mimir to GEM without downtime.
The unification also brings new features to the GEM gateway: OpenShift Route and horizontal autoscaling of the gateway Pods.
The unified configuration lives in the gateway section of the values file. With this we also
deprecate the nginx section. It will be removed in mimir-distributed version 7.0.0.
It is possible to migrate from nginx to the gateway configuration without downtime too. The migration should take
less than 30 minutes. The rest of this article contains a procedure for migrating from the old nignx section to
gateway.
Before you begin
Make sure that the version of the mimir-distributed Helm chart that you have installed is 4.0.0 or higher.
Procedure
Scale out the
gatewaydeployment:Change your Helm chart values file to enable the
gatewayand increase its replicas:- Set the number of replicas of the gateway Deployment to the number of replicas that NGINX is running with.
For example, if you have deployed 10 NGINX replicas, then add the following configuration to your Helm chart values file
custom.yaml:gateway: enabledNonEnterprise: true replicas: 10Deploy your changes:
helm upgrade $RELEASE grafana/mimir-distributed -f custom.yaml
Replace the
nginxdeployment withgateway:Disable NGINX by adding or merging the following configuration with your values file:
nginx: enabled: falseIf you are using the Ingress that the Helm chart provides, then copy the
ingresssection fromnginxtogateway, and override the name to the name of the Ingress resource that the Helm chart created for NGINX or the GEM gateway.Reusing the name allows the
helmcommand to retain the existing resource instead of deleting it and recreating it under a slightly different name. Retaining the existing resource means that the Ingress Controller in your Kubernetes cluster does not need to delete and recreate the backing resources for the Ingress, which might take time depending on which Ingress Controller you use.In the example that follows, the name of the Ingress resource was
mimir-nginx. Usekubectlto get the name of the existing Ingress resource:kubectl get ingressNAME CLASS HOSTS ADDRESS PORTS AGE mimir-nginx <none> mimir.example.com 10.0.0.1 80, 443 172dThe Helm chart values for
gatewayshould look similar to this:gateway: ingress: enabled: true nameOverride: mimir-nginx hosts: - host: mimir.example.com paths: - path: / pathType: Prefix tls: - secretName: mimir-gateway-tls hosts: - mimir.example.com enabledNonEnterprise: true replicas: 10Update the
servicesection.If you are overriding anything in the
nginx.servicesection, then copy the contents ofnginx.servicesection fromnginxtogateway.Next, override the resource name to the name of the Service resource that the chart created for NGINX. Reusing the name allows the
helmcommand to retain the existing resource instead of deleting it and recreating it under a slightly different name. Reusing the name also allows existing clients within the Kubernetes cluster to keep using the nginx Service address without disruption.In the example that follows, the name of the Service resource was
mimir-nginx. Usekubectlto get the name of the existing Service resource:kubecl get serviceNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE mimir-nginx ClusterIP 10.188.8.32 <none> 8080/TCP,9095/TCP 172dAfter carrying out this step the Helm values for
gatewayshould look like the following:gateway: service: annotations: networking.istio.io/exportTo: admin nameOverride: mimir-nginx ingress: enabled: true nameOverride: mimir-nginx hosts: - host: mimir.example.com paths: - path: / pathType: Prefix tls: - secretName: mimir-gateway-tls hosts: - mimir.example.com enabledNonEnterprise: true replicas: 10Update the readiness probe endpoint if you are overriding
nginx.nginxConfig.The readiness probe in the
gatewaysetup uses the/readyendpoint on the containers. Version4.0.0ofmimir-distributedconfigures the NGINX to serve this endpoint. In versions prior to that that endpoint does not exist. If you have copied the contents ofnginx.nginxConfiginto your values file prior to version4.0.0, then you need to correct the readiness probe.After carrying out this step the Helm values for
gatewayshould look like the following:gateway: readinessProbe: httpGet: path: / service: annotations: networking.istio.io/exportTo: admin nameOverride: mimir-nginx ingress: enabled: true nameOverride: mimir-nginx hosts: - host: mimir.example.com paths: - path: / pathType: Prefix tls: - secretName: mimir-gateway-tls hosts: - mimir.example.com enabledNonEnterprise: true replicas: 10Move the rest of your values according the following table:
Deprecated field New field Notes nginx.affinitygateway.affinityPreviously affinitywas a string. Now it should be a YAML object.nginx.annotationsgateway.annotationsnginx.autoscalinggateway.autoscalingnginx.basicAuthgateway.nginx.basicAuthNested under proxy.nginx.nginx.containerSecurityContextgateway.containerSecurityContextnginx.deploymentStrategygateway.strategyRenamed from deploymentStrategytostrategy.nginx.enabledgateway.enablednginx.extraArgsgateway.extraArgsnginx.extraContainersgateway.extraContainersnginx.extraEnvFromgateway.extraEnvFromnginx.extraEnvgateway.envRenamed from extraEnvtoenv.nginx.extraVolumeMountsgateway.extraVolumeMountsnginx.extraVolumesgateway.extraVolumesnginx.imagegateway.nginx.imageNested under proxy.nginx.nginx.ingressgateway.ingressnginx.nginxConfiggateway.nginx.configRenamed from nginxConfigtoconfigand nested underproxy.nginx.nginx.nodeSelectorgateway.nodeSelectornginx.podAnnotationsgateway.podAnnotationsnginx.podDisruptionBudgetgateway.podDisruptionBudgetnginx.podLabelsgateway.podLabelsnginx.podSecurityContextgateway.securityContextRenamed from podSecurityContexttosecurityContext.nginx.priorityClassNamegateway.priorityClassNamenginx.readinessProbegateway.readinessProbenginx.replicasgateway.replicasnginx.resourcesgateway.resourcesnginx.routegateway.routenginx.servicegateway.servicenginx.terminationGracePeriodSecondsgateway.terminationGracePeriodSecondsnginx.tolerationsgateway.tolerationsnginx.topologySpreadConstraintsgateway.topologySpreadConstraintsnginx.verboseLogginggateway.nginx.verboseLoggingNested under proxy.nginx.Upgrade the Helm release with the migrated values file
custom.yaml. This concludes the migration.helm upgrade $RELEASE grafana/mimir-distributed -f custom.yaml
Examples
The examples that follow show how your Helm values file changes after migrating from an NGINX setup to a gateway setup.
nginx:
enabled: true
replicas: 4
deploymentStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 100%
maxUnavailable: 10%
affinity: |
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: noisyNeighbour
operator: In
values:
- 'true'
topologyKey: 'kubernetes.io/hostname'
extraEnv:
- name: SPECIAL_TYPE_KEY
valueFrom:
configMapKeyRef:
name: special-config
key: SPECIAL_TYPE
basicAuth:
enabled: true
username: user
password: pass
image:
tag: 1.25-alpine
nginxConfig:
logFormat: |-
main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
podSecurityContext:
readOnlyRootFilesystem: true
ingress:
enabled: true
hosts:
- host: mimir.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: mimir-gateway-tls
hosts:
- mimir.example.comThe Helm values file after finishing the migration:
nginx:
enabled: false
gateway:
enabledNonEnterprise: true
replicas: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 100%
maxUnavailable: 10%
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: noisyNeighbour
operator: In
values:
- "true"
topologyKey: "kubernetes.io/hostname"
env:
- name: SPECIAL_TYPE_KEY
valueFrom:
configMapKeyRef:
name: special-config
key: SPECIAL_TYPE
nginx:
basicAuth:
enabled: true
username: user
password: pass
image:
tag: 1.25-alpine
nginxConfig:
logFormat: |-
main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
securityContext:
readOnlyRootFilesystem: true
ingress:
enabled: true
nameOverride: mimir-nginx
hosts:
- host: mimir.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: mimir-gateway-tls
hosts:
- mimir.example.com