Skip to content

Instantly share code, notes, and snippets.

@korutx
Last active September 10, 2024 14:48
Show Gist options
  • Save korutx/26a0bd8a05883e43bb85732a28221c16 to your computer and use it in GitHub Desktop.
Save korutx/26a0bd8a05883e43bb85732a28221c16 to your computer and use it in GitHub Desktop.
Upgrading prometheus-community/kube-prometheus-stack

Upgrading prometheus-community/kube-prometheus-stack

This guide outlines the steps to upgrade the Prometheus stack in a Kubernetes cluster.

Prerequisites

  • Helm 3 installed
  • kubectl configured to your cluster
  • Proper permissions to modify resources in the monitoring namespace

Steps

  1. Update Helm repositories:

    helm repo update
  2. Upgrade the Prometheus stack:

    helm upgrade relesease-name prometheus-community/kube-prometheus-stack \
      --install \
      -f "packages/relesease-name/values-dev.yaml" \
      --namespace monitoring \
      --create-namespace

    Note: Replace relesease-name with your release name and adjust the values file path as needed.

  3. Scale down Grafana deployment to release the PVC:

    kubectl scale deployment relesease-name-grafana -n monitoring --replicas=0
  4. Scale up Grafana deployment:

    kubectl scale deployment relesease-name-grafana -n monitoring --replicas=1
  5. Verify the upgrade:

    kubectl get pods -n monitoring

Troubleshooting

If you encounter a "Multi-Attach error for Volume" after scaling up Grafana, repeat steps 3 and 4.

Notes

  • Ensure you have a backup of your Prometheus and Grafana data before upgrading.
  • Review the changelog of the kube-prometheus-stack for any breaking changes before upgrading.
  • Adjust resource requests and limits in your values file if needed after the upgrade.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment