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:
-
Use the Helm Installation Guide to install Helm (if not already installed).
-
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
-
Create a namespace for Kube State Metrics.
Example:
kubectl create namespace kube-state-metrics
-
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.
-
-
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:
-
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
-
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:
-
Use the Helm Installation Guide to install Helm (if not already installed).
-
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.
-
-
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:
-
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.
-
-
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.