Automated deployment

Before you begin, you’ll need:

  • kube-state-metrics installed
  • Destination port 5015 open on your firewall for outgoing traffic
  • Kubelet read-only-port 10255 enabled. Kubelet read-only-port 10255 is enabled by default on some cluster versions. If it isn’t enabled, follow Kubernetes’s instructions for enabling 10255 as a read-only-port in Kubelet’s config file.
Run the automated deployment script
bash <(curl -s https://raw.githubusercontent.com/logzio/logzio-helm/master/quickstart-metrics.sh)
Prompts and answers
Prompt Description
logzio-metrics-shipping-token Replace <<SHIPPING-TOKEN>> with a token for the Metrics account you want to ship to.
Here’s how to look up your Metrics token.
Logz.io region Blank (US East) Two-letter region code, or blank for US East (Northern Virginia). This determines your listener URL (where you’re shipping the logs to) and API URL.
You can find your region code in the Regions and URLs table.
Kubelet communication protocol http http or https. If your Kubernetes setup is EKS, you’ll need to use https.
Target namespace kube-system Select a namespace to serve as the origin for Logz.io’s Metricbeat Deamonset deployment. The deployment monitors the entire cluster, regardless of which namespace is selected as the origin. It’s a good idea to avoid a namespace that already has Metricbeat installed.
Cluster name Detected by the script The name of the Kubernetes cluster you’re deploying in.
Check Logz.io for your metrics

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

Manual deployment

Before you begin, you’ll need:

  • kube-state-metrics installed
  • Destination port 5015 open on your firewall for outgoing traffic
  • Kubelet read-only-port 10255 enabled. Kubelet read-only-port 10255 is enabled by default on some cluster versions. If it isn’t enabled, follow Kubernetes’s instructions for enabling 10255 as a read-only-port in Kubelet’s config file.
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 with a compatible version to your cluster.

Store your Logz.io credentials

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

Replace <<SHIPPING-TOKEN>> with a token for the Metrics account you want to ship to.
Here’s how to look up your Metrics token.

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>>
Gather your cluster details

In the next step, you’ll need the following cluster details:

  • <<KUBE-STATE-METRICS-NAMESPACE>>
  • <<KUBE-STATE-METRICS-PORT>>
  • <<CLUSTER-NAME>>

If you already have them, you can skip to the next step. Otherwise, we’ll walk you through the steps of how to get them.

To get your <<KUBE-STATE-METRICS-NAMESPACE>>, run the following command:

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

To find the kube-state-metrics port, run the following command. (Before you run it, be sure to replace the placeholder <> with your cluster details.) The port will be listed in the output, under `http-metrics`.

kubectl get service -n <<KUBE-STATE-METRICS-NAMESPACE>> kube-state-metrics -o yaml

Next, get your <<CLUSTER-NAME>>. If you manage Kubernetes in AWS or Azure, you can find it in your admin console. Otherwise, you can run this command:

kubectl cluster-info
Save your cluster details as a Kubernetes secret

For this step, you’ll need the cluster details you gathered in the previous step:

  • <<KUBE-STATE-METRICS-NAMESPACE>>
  • <<KUBE-STATE-METRICS-PORT>>
  • <<CLUSTER-NAME>>

Replace the placeholders in the following command. Then run it 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

Deploy one of these configurations.

If your Kubernetes setup is EKS, you’ll need to use the HTTPS deployment.

For HTTP communication with kubelet
kubectl --namespace=kube-system create -f https://raw.githubusercontent.com/logzio/logz-docs/master/shipping-config-samples/k8s-metricbeat-http.yml
...Or for HTTPS communication with kubelet

If you want your internal kubelet communication over HTTPs, make sure you update your CA certificate accordingly.

kubectl --namespace=kube-system create -f https://raw.githubusercontent.com/logzio/logz-docs/master/shipping-config-samples/k8s-metricbeat-https.yml
Check Logz.io for your metrics

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