sysdig

by joaquinito2051

Helm chartv1.4.7App 0.89.5

Sysdig Monitor and Secure agent

About this chart

Sysdig

Sysdig is a unified platform for container and microservices monitoring, troubleshooting, security and forensics. Sysdig platform has been built on top of Sysdig tool and Sysdig Inspect open-source technologies.

Introduction

This chart adds the Sysdig agent for Sysdig Monitor and Sysdig Secure to all nodes in your cluster via a DaemonSet.

Prerequisites

  • Kubernetes 1.2+ with Beta APIs enabled

Installing the Chart

To install the chart with the release name my-release, retrieve your Sysdig Monitor Access Key from your Account Settings and run:

$ helm install --name my-release --set sysdig.accessKey=YOUR-KEY-HERE <helm-repo>/sysdig

$ helm install --name my-release --set sysdig.accessKey=YOUR-KEY-HERE stable/sysdig After a few seconds, you should see hosts and containers appearing in Sysdig Monitor and Sysdig Secure.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

Tip: Use helm delete --purge my-release to completely remove the release from Helm internal storage

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the Sysdig chart and their default values.

ParameterDescriptionDefault
image.registrySysdig agent image registrydocker.io
image.repositoryThe image repository to pull fromsysdig/agent
image.tagThe image tag to pull0.89.5
image.pullPolicyThe Image pull policyIfNotPresent
image.pullSecretsImage pull secretsnil
resources.requests.cpuCPU requested for being run in a node100m
resources.requests.memoryMemory requested for being run in a node512Mi
resources.limits.cpuCPU limit200m
resources.limits.memoryMemory limit1024Mi
rbac.createIf true, create & use RBAC resourcestrue
serviceAccount.createCreate serviceAccounttrue
serviceAccount.nameUse this value as serviceAccountName
daemonset.updateStrategy.typeThe updateStrategy for updating the daemonsetRollingUpdate
ebpf.enabledEnable eBPF support for Sysdig instead of sysdig-probe kernel modulefalse
ebpf.settings.mountEtcVolumeNeeded to detect which kernel version are running in Google COStrue
sysdig.accessKeyYour Sysdig Monitor Access KeyNil You must provide your own key
sysdig.settingsSettings for agent's configuration file
secure.enabledEnable Sysdig Securefalse
customAppChecksThe custom app checks deployed with your agent{}
tolerationsThe tolerations for schedulingnode-role.kubernetes.io/master:NoSchedule

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
$ helm install --name my-release \
    --set sysdig.accessKey=YOUR-KEY-HERE,sysdig.settings.tags="role:webserver,location:europe" \
    <helm-repo>/sysdig
$ helm install --name my-release \

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

$ helm install --name my-release -f values.yaml <helm-repo>/sysdig

$ helm install --name my-release -f values.yaml stable/sysdig

Tip: You can use the default values.yaml

On-Premise backend deployment settings

Sysdig platform backend can be also deployed On-Premise in your own infrastructure.

Installing the agent using the Helm chart is also possible in this scenario, and you can enable it with the following parameters:

ParameterDescriptionDefault
sysdig.settings.collectorThe IP address or hostname of the collector
sysdig.settings.collector_portThe port where collector is listening
sysdig.settings.sslThe collector accepts SSLtrue
sysdig.settings.ssl_verify_certificateSet to false if you don't want to verify SSL certificatetrue

For example:

$ helm install --name my-release \
    --set sysdig.accessKey=YOUR-KEY-HERE \
    --set sysdig.settings.collector=42.32.196.18 \
$ helm install --name my-release \
    --set sysdig.settings.collector_port=6443 \
    --set sysdig.settings.ssl_verify_certificate=false \
    stable/sysdig

Using private Docker image registry

If you pull the Sysdig agent Docker image from a private registry that requires authentication, some additional configuration is required.

First, create a secret that stores the registry credentials:

$ kubectl create secret docker-registry SECRET_NAME \
  --docker-server=SERVER \
  --docker-username=USERNAME \
  --docker-password=TOKEN \
  --docker-email=EMAIL

Then, point to this secret in the values YAML file:

sysdig:
  accessKey: YOUR-KEY-HERE
image:
  registry: myrepo.mydomain.tld
  repository: sysdig-agent
  tag: latest-tag
  pullSecrets:
    - name: SECRET_NAME

Finally, set the accessKey value and you are ready to deploy the Sysdig agent using the Helm chart:

$ helm install --name my-release -f values.yaml <helm-repo>/sysdig

$ helm install --name my-release -f values.yaml stable/sysdig You can read more details about this in Kubernetes Documentation.

Modifying Sysdig agent configuration

The Sysdig agent uses a file called dragent.yaml to store the configuration.

Using the Helm chart, the default configuration settings can be updated using sysdig.settings either via --set sysdig.settings.key = value or in the values YAML file. For example, to eanble Prometheus metrics scraping, you need this in your values.yaml file::

sysdig:
  accessKey: YOUR-KEY-HERE
  settings:
    prometheus:
      enabled: true
      histograms: true
$ helm install --name my-release -f values.yaml <helm-repo>/sysdig

$ helm install --name my-release -f values.yaml stable/sysdig

Upgrading Sysdig agent configuration

If you need to upgrade the agent configuration file, first modify the YAML file (in this case we are increasing the metrics limit scraping Prometheus metrics):

sysdig:
  accessKey: YOUR-KEY-HERE
  settings:
    prometheus:
      enabled: true
      histograms: true
      max_metrics: 2000
      max_metrics_per_process: 400

And then, upgrade Helm chart with:

$ helm upgrade my-release -f values.yaml stable/sysdig

Adding custom AppChecks

Application checks are integrations that allow the Sysdig agent to collect metrics exposed by specific services. Sysdig has several built-in AppChecks, but sometimes you might need to create your own.

Your own AppChecks can deployed with the Helm chart embedding them in the values YAML file:

customAppChecks:
  sample.py: |-
    from checks import AgentCheck

    class MyCustomCheck(AgentCheck):
        def check(self, instance):
            self.gauge("testhelm", 1)

sysdig:
  accessKey: YOUR-KEY-HERE
  settings:
    app_checks:
      - name: sample
        interval: 10
        pattern: # pattern to match the application
          comm: myprocess
        conf:
          mykey: myvalue

The first section, dumps the AppCheck in a Kubernetes configmap and makes it available within the Sysdig agent container. The second, configures it on the dragent.yaml file.

Once the values YAML file is ready, we will deploy the Chart like before:

$ helm install --name my-release -f values.yaml <helm-repo>/sysdig

$ helm install --name my-release -f values.yaml stable/sysdig

Automating the generation of custom-app-checks.yaml file

Sometimes editing and maintaining YAML files can be a bit cumbersome and error prone, so we have created a script for automating this process and make your life easier.

Imagine that you have custom AppChecks for a number of services like Redis, MongoDB and Traefik.

You have already a values.yaml with just your configuration:

sysdig:
  accessKey: YOUR-KEY-HERE
  settings:
    app_checks:
      - name: myredis
        [...]
      - name: mymongo
        [...]
      - name: mytraefik
        [...]

You can generate an additional values YAML file with the custom AppChecks:

$ git clone https://github.com/kubernetes/charts.git
$ cd stable/sysdig
$ ./scripts/appchecks2helm appChecks/solr.py appChecks/traefik.py appChecks/nats.py > custom-app-checks.yaml

And deploy the Chart with both of them:

$ helm install --name my-release -f custom-app-checks.yaml -f values.yaml <helm-repo>/sysdig

$ helm install --name my-release -f custom-app-checks.yaml -f values.yaml stable/sysdig

Deploy sysdig with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has sysdig on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartsysdig is pinned at v1.4.7 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply