helm / charts

⚠️(OBSOLETE) Curated applications for Kubernetes
Apache License 2.0
15.49k stars 16.8k forks source link

[stable/grafana] problem to upgrade chart to latest version #22459

Closed davidoceans closed 4 years ago

davidoceans commented 4 years ago

Describe the bug I have a problem to update to latest version of grafana image. I would like upgrade to 7.0.0 Seems a problem with persistent volume. I don't know why or how to solve it.

I have a grafana installation made months ago by helm install --name grafana stable/grafana -f grafana_custom-values.yaml --namespace monitoring

adminPassword: "xxxx"
ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
    kubernetes.io/tls-acme: "true"
  hosts:
    - grafana.domain.com
  tls:
    - secretName: certs-com-certs
      hosts:
        - grafana.domain.com
persistence:
  enabled: true
  accessModes: ["ReadWriteOnce"]
  size: 20Gi
plugins:
  - grafana-clock-panel
  - grafana-piechart-panel
  - doitintl-bigquery-datasource
  - camptocamp-prometheus-alertmanager-datasource
  - vonage-status-panel

Version of Helm and Kubernetes: HELM VERSION = 2.16.1 KUBERNETES VERSION = 1.18.2

Which chart: CHART VERSION grafana-4.0.2 APP VERSION 6.4.2

What happened:

helm upgrade -f grafana_custom_values.yaml grafana stable/grafana --set image.tag=7.0.0
E0519 15:50:02.002428    7647 portforward.go:372] error copying from remote stream to local connection: readfrom tcp4 127.0.0.1:32981->127.0.0.1:38726: write tcp4 127.0.0.1:32981->127.0.0.1:38726: write: broken pipe
UPGRADE FAILED
Error: PersistentVolumeClaim "grafana" is invalid: spec: Forbidden: is immutable after creation except resources.requests for bound claims && Deployment.apps "grafana" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/instance":"grafana", "app.kubernetes.io/name":"grafana"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
Error: UPGRADE FAILED: PersistentVolumeClaim "grafana" is invalid: spec: Forbidden: is immutable after creation except resources.requests for bound claims && Deployment.apps "grafana" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/instance":"grafana", "app.kubernetes.io/name":"grafana"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

What you expected to happen: Update without problems...

How to reproduce it (as minimally and precisely as possible): helm upgrade -f grafana_custom_values.yaml grafana stable/grafana --set image.tag=7.0.0

Anything else we need to know: I don't know how I can upgrade without lose anything.

davidoceans commented 4 years ago

I have been able to solve the problem of the PV, by default grafana uses the storageClass default, but if you do not put any in GCP it uses one called standard, it is enough to specify it so that it does not use the default but the current (in my case standard).

persistence:
  storageClassName: standard
  enabled: true
  accessModes: ["ReadWriteOnce"]
  size: 20Gi

But another error has appeared, this I do not know how to fix it.

helm upgrade -f grafana_custom_values-v2.yaml grafana stable/grafana --set image.tag=7.0.0
UPGRADE FAILED
Error: Deployment.apps "grafana" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/instance":"grafana", "app.kubernetes.io/name":"grafana"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
Error: UPGRADE FAILED: Deployment.apps "grafana" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/instance":"grafana", "app.kubernetes.io/name":"grafana"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

This the describe of my actual deployment

k describe deploy grafana -n monitoring
Name:                   grafana
Namespace:              monitoring
CreationTimestamp:      Wed, 20 May 2020 14:49:29 +0200
Labels:                 app=grafana
                        chart=grafana-4.0.2
                        heritage=Tiller
                        release=grafana
Annotations:            deployment.kubernetes.io/revision: 1
Selector:               app=grafana,release=grafana
Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:           RollingUpdate

Any suggestion? I have to change or specify something in the values?

Thank you very much

mced commented 4 years ago

@davidoceans Did you try with the latest chart version: 5.0.26 ?