Skip to main content
In this hands-on guide, you’ll learn how to install Falco on an Ubuntu VM running a Kubernetes cluster, generate security alerts, and view them directly in your terminal. Falco is a runtime security tool for detecting anomalous activity in your containers and hosts.

Prerequisites

  • Ubuntu-based virtual machine (18.04+).
  • Kubernetes cluster up and running.
  • kubectl configured to talk to your cluster.
  • Root or sudo privileges.

1. Install Falco on Ubuntu

First, add the Falco repository, import its GPG key, update package lists, install kernel headers, and then install Falco:
Installing kernel headers is required for the Falco DKMS module to build against your running kernel.
After installation, you should see output similar to:

2. Verify the Installation

  1. Check Falco service status
    Falco may run as a daemon or via a container, depending on your setup.
  2. Inspect the configuration directory
    You should see:
  3. Stream Falco logs

3. Generate a Kubernetes Alert

Open two terminal windows:
  • Terminal A: Stream Falco logs
  • Terminal B: Trigger an alert
As soon as the shell spawns inside the container, Falco will emit a notice:
This alert output references dynamic fields such as %proc.cmdline, %user.name, %container.name, %k8s.pod.name, %k8s.ns.name, and %container.image.

4. Inspect the Alert Rule

Falco’s built-in rules are defined in falco_rules.yaml. To view the rule that detects terminal shells in containers:
Example snippet:
Macros like in_container and lists such as shell_binaries are defined elsewhere in the configuration. For full details on writing and customizing rules, see the Falco documentation.

5. Next Steps

We recommend integrating Falco with a centralized dashboard or SIEM to manage alerts at scale. In the next tutorial, we’ll cover:
  • Deploying Falco Manager and Falco Plugins.
  • Sending alerts to a web UI (e.g., Grafana, Kibana).
  • Custom rule authoring for advanced threat detection.

Watch Video