Configuration

Check for kube-state-metrics in your cluster
kubectl get pods --all-namespaces | grep kube-state-metrics

If you see a response, that means kube-state-metrics is installed, and you can move on to step 2.

Otherwise, deploy kube-state-metrics to your cluster.

git clone https://github.com/kubernetes/kube-state-metrics.git \
  && kubectl --namespace=kube-system apply -f kube-state-metrics/examples/standard
Store your Logz.io credentials

Save your Logz.io shipping credentials as a Kubernetes secret.

Replace <<SHIPPING-TOKEN>> with the token of the account you want to ship to.

Replace <<LISTENER-HOST>> with your region’s listener host (for example, listener.logz.io). For more information on finding your account’s region, see Account region.

kubectl --namespace=kube-system create secret generic logzio-metrics-secret \
  --from-literal=logzio-metrics-shipping-token=<<SHIPPING-TOKEN>> \
  --from-literal=logzio-metrics-listener-host=<<LISTENER-HOST>>
Store your cluster details

Paste the kube-state-metrics namespace and port in your text editor. You can find them by running this command.

kubectl get service --all-namespaces | grep -E 'kube-state-metrics|NAMESPACE'

Paste the cluster name in your text editor. You can find it by running this command, or if you manage Kubernetes in AWS or Azure, you can find it in your admin console.

kubectl cluster-info

Now replace <<KUBE-STATE-METRICS-NAMESPACE>>, <<KUBE-STATE-METRICS-PORT>>, and <<CLUSTER-NAME>> in this command to save your cluster details as a Kubernetes secret.

kubectl --namespace=kube-system create secret generic cluster-details \
  --from-literal=kube-state-metrics-namespace=<<KUBE-STATE-METRICS-NAMESPACE>> \
  --from-literal=kube-state-metrics-port=<<KUBE-STATE-METRICS-PORT>> \
  --from-literal=cluster-name=<<CLUSTER-NAME>>
Deploy
kubectl --namespace=kube-system create -f https://raw.githubusercontent.com/logzio/logz-docs/master/shipping-config-samples/k8s-metricbeat.yml
Check Logz.io for your metrics

Give your metrics some time to get from your system to ours, and then open Logz.io.