--- title: "How To Install or Upgrade Kube State Metrics" slug: "how-to-install-or-upgrade-kube-state-metrics" updated: 2023-11-20T23:34:14Z published: 2023-11-20T23:34:14Z canonical: "resources.realtheory.io/how-to-install-or-upgrade-kube-state-metrics" --- > ## Documentation Index > Fetch the complete documentation index at: https://resources.realtheory.io/llms.txt > Use this file to discover all available pages before exploring further. # How To Install or Upgrade Kube State Metrics ## Background RealTheory can notify you if Kube State Metrics is a required component in your environment that is not present on your cluster or if the version of Kube State Metrics that is installed is not in compliance with organizational standards. ## Solution - Installation If Kube State Metrics is a required component in your Kubernetes environment, it is most likely that the Helm Chart or the manifest file needed for the installation already exist. Contact your Operations or DevOps team to determine if there are company resources for installing Kube State Metrics **BEFORE** using either of the following procedures. ### Procedure Using HELM Chart Package Manager To install Kube State Metrics: 1. Use the [Helm Installation Guide](https://helm.sh/docs/intro/install/) to install Helm (if not already installed). 2. Use the following commands to add the Kube State Metrics Helm chart repository: `helm repo add kube-state-metrics https://github.com/kubernetes/kube-state-metrics` `helm repo update` 3. Create a namespace for Kube State Metrics. **Example:** `kubectl create namespace kube-state-metrics` 4. Do one of the following: - To install the latest version, use the following command: `helm install kube-state-metrics kube-state-metrics/kube-state-metrics --namespace kube-state-metrics` - To install a specific version, use the following command: `helm install kube-state-metrics kube-state-metrics/kube-state-metrics --namespace kube-state-metrics --version <version>` where `<version>` is the version number of Kube State Metrics you want to install. 5. Verify the Kube State Metrics pods are running: `kubectl get pods -n kube-state-metrics` You should see Kube State Metrics-related pods running. ### Procedure Using the YAML Manifest To install Kube State Metrics: 1. Apply the latest Kube State Metrics manifests: `kubectl apply -f https://github.com/kubernetes/kube-state-metrics/releases/latest/download/kube-state-metrics-standalone-release.yaml` 2. Verify the Kube State Metrics pods are running: `kubectl get pods -n <namespace>` where `<namespace>` is the namespace where Kube State Metrics was installed. You should see Kube State Metrics-related pods running. ## Solution - Upgrade If a specific version of Kube State Metrics is required in your Kubernetes environment, it is most likely that the Helm Chart or the manifest file already exist. Contact your Operations or DevOps team to determine if there are company resources for upgrading Kube State Metrics **BEFORE** using either of the following procedures. ### Procedure Using HELM Chart Package Manager To upgrade Kube State Metrics: 1. Use the [Helm Installation Guide](https://helm.sh/docs/intro/install/) to install Helm (if not already installed). 2. Do one of the following: - To upgrade to the latest version, use the following command: `helm upgrade <release-name> kube-state-metrics/kube-state-metrics --namespace <namespace>` where `<release-name>` is the name of the Kube State Metrics release and `<namespace>` is the namespace where Kube State Metrics is installed. - To upgrade to a specific version, use the following command: `helm upgrade <release-name> kube-state-metrics/kube-state-metrics --namespace <namespace> --version <version>` where `<release-name>` is the name of the Kube State Metrics release, `<namespace>` is the namespace where Kube State Metrics is installed and `<version>` is the version number of Kube State Metrics you want to upgrade to. 3. Verify the Kube State Metrics pods are running and have been updated: `kubectl get pods -n <namespace>` where `<namespace>` is the namespace where Kube State Metrics is installed. You should see Kube State Metrics-related pods running. ### Procedure Using YAML Manifest To upgrade Kube State Metrics: 1. Do one of the following: - To upgrade to the latest version: `kubectl apply -f https://github.com/kubernetes/kube-state-metrics/releases/latest/download/kube-state-metrics-standalone-release.yaml` - To upgrade to a specific version: `kubectl apply -f https://github.com/kubernetes/kube-state-metrics/releases/download/<version>/kube-state-metrics-standalone-release.yaml` where `<version>` is the version number of Kube State Metrics you want to upgrade to. 2. Verify the Kube State Metrics pods are running and have been updated: `kubectl get pods -n <namespace>` where `<namespace>` is the namespace where Kube State Metrics is installed. You should see Kube State Metrics-related pods running.