Helm is a tool for managing packages of pre-configured Kubernetes resources, known as Charts.

You can ship metrics from your Kubernetes cluster using Logzio-k8s-metrics.

This Daemonset can be deployed using a standard configuration or Metricbeat autodiscover, for even more powerful automation.

Before you begin, you’ll need:

  • Helm CLI installed
  • kube-state-metrics installed
  • Metricbeat 7.6 or higher for Autodiscover support. This integration defaults to Metricbeat 7.9.1.
  • To allow outgoing traffic to destination port 5015
  • 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

Automated deployment

This is the simplest method for deployment but it doesn’t offer advanced configuration options. The chart will be deployed according to the listed parameter defaults.

Run the automated deployment script
bash <(curl -s https://raw.githubusercontent.com/logzio/logzio-helm/master/quickstart-metrics.sh)

Note: The script is currently only compatible with Helm 3.

Add the configuration

Follow through the system’s prompts and provide the requested parameters.

Prompt Answer
Logz.io 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 (Default: 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.
Cluster name (Default: detected by the script) Name of the Kubernetes cluster in which you are deploying.
Standard or autodiscover deployment (Default: standard) To deploy with configuration templates answer ‘autodiscover’.
Open your Kubernetes dashboard in Logz.io

Give your metrics a few minutes to get from your system to ours, and then open Logz.io.

Your metrics should appear in the preconfigured dashboard in your Metrics account. To open it, click > Manage in the left menu, then click Logz.io Dashboards > Kubernetes.

Manual deployment

This method of deployment gives you greater control over the configuration.

Add 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>>
Store your cluster details

Run the command below to save your cluster details as a Kubernetes secret. The command has placeholders that you’ll need to replace with your own cluster information.

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>>

Replace the following placeholders in the command before running it:

  • <<KUBE-STATE-METRICS-NAMESPACE>>
  • <<KUBE-STATE-METRICS-PORT>>
  • <<CLUSTER-NAME>>
Add the logzio-k8s-metrics repo to your helm repo list
helm repo add logzio-helm https://logzio.github.io/logzio-helm/metricbeat
Deploy

You have three options for deployment:

Deploy with standard configuration
helm install --namespace=kube-system logzio-k8s-metrics logzio-helm/logzio-k8s-metrics
Deploy with Autodiscover configuration:

This Daemonset’s default autodiscover configuration is hints based:

helm install --namespace=kube-system \
--set configType='autodiscover' \
logzio-k8s-metrics logzio-helm/logzio-k8s-metrics

For more information about Autodiscover, see Kubernetes configuration and autodiscover’s appenders.

Deploy with custom configuration:
helm install --namespace=kube-system \
--set configType='auto-custom' \
--set-file metricbeatConfig.autoCustomConfig=/path/to/your/config.yaml \
logzio-k8s-metrics logzio-helm/logzio-k8s-metrics

If you’re using a custom config, please make sure that you’re using a valid .yaml file in the following structure:

metricbeat.yml: |-
  metricbeat.config.modules:
    path: ${path.config}/modules.d/*.yml
    reload.enabled: false
  metricbeat.autodiscover:
    # your autodiscover config
    # ...

  processors:
    - add_cloud_metadata: ~
  fields:
    logzio_codec: json
    token: ${LOGZIO_METRICS_SHIPPING_TOKEN}
    cluster: ${CLUSTER_NAME}
    type: metricbeat
  fields_under_root: true
  ignore_older: 3hr
  output:
    logstash:
      hosts: ["${LOGZIO_METRICS_LISTENER_HOST}:5015"]
      ssl:
        certificate_authorities: ['/etc/pki/tls/certs/SectigoRSADomainValidationSecureServerCA.crt']
Open your Kubernetes dashboard in Logz.io

Give your metrics a few minutes to get from your system to ours, and then open Logz.io.

Your metrics should appear in the preconfigured dashboard in your Metrics account. To open it, click > Manage in the left menu, then click Logz.io Dashboards > Kubernetes.

To override values in a chart

When you don’t want the default values, you can override them in the chart by using the --set flag and passing the configuration from the command line.

Specify each parameter argument in the format --set key=value[,key=value] immediately after the command helm install. For example, to set the imageTag and terminationGracePeriodSeconds values, run:

helm install --namespace=kube-system logzio-k8s-metrics logzio-helm/logzio-k8s-metrics \
  --set=imageTag=7.7.0,terminationGracePeriodSeconds=30

To override configurations such as metricbeatConfig.autoCustomConfig, deployment.metricbeatConfig.custom and daemonset.metricbeatConfig.custom, use the --set-file argument in helm install. For example,

helm install --namespace=kube-system logzio-k8s-metrics logzio-helm/logzio-k8s-metrics \
  --set-file deployment.metricbeatConfig.custom=/path/to/your/config.yaml

Configuration options

Parameter Description Default
image The Metricbeat Docker image. "docker.elastic.co/beats/metricbeat"
imageTag The Metricbeat Docker image tag. "7.9.1"
nameOverride Overrides the Chart name for resources. ""
fullnameOverride Overrides the full name of the resources. "metricbeat"
apiVersions.ConfigMap API version of configmap.yaml. v1
apiVersions.Deployment API version of deployment.yaml. apps/v1
apiVersions.DaemonSet API version of daemonset.yaml. apps/v1
apiVersions.ServiceAccount API version of serviceaccount.yaml. v1
apiVersions.ClusterRole API version of clusterrole.yaml. rbac.authorization.k8s.io/v1beta1
apiVersions.ClusterRoleBinding API version of clusterrolebinding.yaml. rbac.authorization.k8s.io/v1beta1
shippingProtocol Shipping protocol. http
shippingPort Shipping port. 10255
serviceAccount.create Specifies whether a service account should be created. true
serviceAccount.name Name of the service account. metricbeat
podSecurityContext Configurable securityContext for Metricbeat DaemonSet and Deployment pod execution environment. {}
resources Sets the resources for both your Metricbeat DaemonSet and Deployment. {}
clusterRoleRules Configurable cluster role rules that Metricbeat uses to access Kubernetes resources. See values.yaml.
managedServiceAccount Set to true to enable the option to manage the serviceAccount by the Helm chart. Otherwise, set to false to manage your own service account and related roles. true
secretMounts Mounts a secret as a file inside both your Metricbeat DaemonSet and Deployment. You can use it to mount certificates and other secrets. See values.yaml.
terminationGracePeriod In case of pod shutdown, the waiting period in seconds before killing the Metricbeat pod process. 30
hostPathRoot Fully-qualified hostPath that will be used to persist Metricbeat registry data. /var/lib
logzioCert Logzio public SSL certificate. See values.yaml.
metricbeatConfig Metricbeat configuration. See values.yaml.
daemonset.leanConfig When set to true, sets the Daemonset’s Metricbeat modules configuration to the minimal configuration required to populate Logz.io’s dashboards. See values.yaml.
daemonset.extraVolumeMounts Templatable string of additional volumeMounts to be passed to the DaemonSet. See values.yaml.
daemonset.extraVolumes Templatable string of additional volumes to be passed to the DaemonSet. See values.yaml.
daemonset.metricbeatConfig.default Default configuration for Daemonset’s Metricbeat modules. See values.yaml.
daemonset.metricbeatConfig.lean Lean configuration for Daemonset’s Metricbeat modules. See values.yaml.
daemonset.metricbeatConfig.custom Allows you to add any config files in /usr/share/metricbeat such as metricbeat.yml for Metricbeat Daemonset.
Please note that the custom config should be formatted and indented as in daemonset.metricbeat.config.default.
{}
daemonset.securityContext Configurable securityContext for Metricbeat DaemonSet pod execution environment. See values.yaml.
daemonset.resources Sets the resources for your Metricbeat deployment. See values.yaml.
daemonset.secretMounts Mounts a secret as a file inside the DaemonSet. You can use it to mount certificates and other secrets. See values.yaml.
daemonset.sslVerificationMode Sets the SSL verification mode for Metricbeat. "none"
deployment.extraVolumeMounts Templatable string of additional volumeMounts to be passed to the deployment. See values.yaml.
deployment.extraVolumes Templatable string of additional volumes to be passed to the deployment. See values.yaml.
deployment.metricbeatConfig.default Default configuration for Deployment’s Metricbeat modules. See values.yaml.
deployment.metricbeatConfig.lean Lean configuration for Deployment’s Metricbeat modules. See values.yaml.
deployment.metricbeatConfig.custom Allows you to add any config files in /usr/share/metricbeat such as metricbeat.yml for Metricbeat Deployment.
Please note that the custom config should be formatted and indented as in deployment.metricbeat.config.default.
{}
deployment.securityContext Configurable securityContext for your Metricbeat deployment pod execution environment. See values.yaml.
deployment.resources Sets the resources for your Metricbeat deployment. See values.yaml.
deployment.secretMounts Mounts a secret as a file in the deployment. You can use it to mount certificates and other secrets. See values.yaml.
namespace Chart’s namespace kube-system

To uninstall the chart

To uninstall the chart, run the following command to remove all k8s components associated with the Chart and delete the release. For example, to uninstall the logzio-k8s-metrics deployment, run:

helm uninstall --namespace=kube-system logzio-k8s-metrics