Commit Graph

88 Commits

Author SHA1 Message Date
Bryan Boreham
3e9eb83d12 Use Kubernetes node name to filter pods if possible 2017-07-13 16:24:17 +00:00
Roland Schilter
651e52b5a5 Honor DOCKER_* env variables in probe and app
Changed default for flag `-app.docker` to use the DOCKER_* env variables
instead of hardcoded /var/run/docker.sock; uses docker's default if
no DOCKER_HOST defined, for both probe and app.

Fixes #1975
2017-06-27 17:14:49 +02:00
Alban Crequy
d715ccc391 ebpf: handle fd_install events from tcptracer-bpf
Since https://github.com/weaveworks/tcptracer-bpf/pull/39, tcptracer-bpf
can generate "fd_install" events when a process installs a new file
descriptor in its fd table. Those events must be requested explicitely
on a per-pid basis with tracer.AddFdInstallWatcher(pid).

This is useful to know about "accept" events that would otherwise be
missed because kretprobes are not triggered for functions that were
called before the installation of the kretprobe.

This patch find all the processes that are currently blocked on an
accept() syscall during the EbpfTracker initialization.
feedInitialConnections() will use tracer.AddFdInstallWatcher() to
subscribe to fd_install  events. When a fd_install event is received,
synthesise an accept event with the connection tuple and the network
namespace (from /proc).
2017-05-19 14:49:38 +02:00
Bryan Boreham
0281d4aeef Fix typo 2017-04-23 16:58:15 +00:00
Matthias Radestock
413dbc7f0c allow disabling of weaveDNS advertising/lookup
...while keeping other weave integrations, by setting
--weave.hostname=

Addresses a suggestion in #1550.
2017-04-15 00:02:07 +01:00
Michael Schubert
22ae6c45a0 Implement ebpf proc fallback 2017-03-14 13:59:09 +01:00
Iago López Galeiras
9920c4ea48 Add eBPF connection tracking without dependencies on kernel headers
Based on work from Lorenzo, updated by Iago, Alban, Alessandro and
Michael.

This PR adds connection tracking using eBPF. This feature is not enabled by default.
For now, you can enable it by launching scope with the following command:

```
sudo ./scope launch --probe.ebpf.connections=true
```

This patch allows scope to get notified of every connection event,
without relying on the parsing of /proc/$pid/net/tcp{,6} and
/proc/$pid/fd/*, and therefore improve performance.

We vendor https://github.com/iovisor/gobpf in Scope to load the
pre-compiled ebpf program and https://github.com/weaveworks/tcptracer-bpf
to guess the offsets of the structures we need in the kernel. In this
way we don't need a different pre-compiled ebpf object file per kernel.
The pre-compiled ebpf program is included in the vendoring of
tcptracer-bpf.

The ebpf program uses kprobes/kretprobes on the following kernel functions:
- tcp_v4_connect
- tcp_v6_connect
- tcp_set_state
- inet_csk_accept
- tcp_close

It generates "connect", "accept" and "close" events containing the
connection tuple but also pid and netns.
Note: the IPv6 events are not supported in Scope and thus not passed on.

probe/endpoint/ebpf.go maintains the list of connections. Similarly to
conntrack, it also keeps the dead connections for one iteration in order
to report short-lived connections.

The code for parsing /proc/$pid/net/tcp{,6} and /proc/$pid/fd/* is still
there and still used at start-up because eBPF only brings us the events
and not the initial state. However, the /proc parsing for the initial
state is now done in foreground instead of background, via
newForegroundReader().

NAT resolution on connections from eBPF works in the same way as it did
on connections from /proc: by using conntrack. One of the two conntrack
instances is only started to get the initial state and then it is
stopped since eBPF detects short-lived connections.

The Scope Docker image size comparison:
- weaveworks/scope in current master:  22 MB (compressed),  68 MB
  (uncompressed)
- weaveworks/scope with this patchset: 23 MB (compressed), 69 MB
  (uncompressed)

Fixes #1168 (walking /proc to obtain connections is very expensive)

Fixes #1260 (Short-lived connections not tracked for containers in
shared networking namespaces)

Fixes #1962 (Port ebpf tracker to Go)

Fixes #1961 (Remove runtime kernel header dependency from ebpf tracker)
2017-03-08 22:11:12 +01:00
Alfonso Acosta
052ff39bf1 Merge pull request #2309 from weaveworks/2258-fix-kubelet-access
Fix kubelet failure fallback and make port configurable
2017-03-08 10:15:21 -08:00
Alfonso Acosta
8bf753a51b Revert "Revert "Add options to hide args and env vars (#2306)"" (#2311)
* Revert "Revert "Add options to hide args and env vars (#2306)""

* Make linter happy
2017-03-08 02:16:42 -08:00
Alfonso Acosta
dcc7389127 Revert "Add options to hide args and env vars (#2306)"
This reverts commit 764afb6301.
2017-03-07 17:51:27 +01:00
Mike Bryant
764afb6301 Add options to hide args and env vars (#2306)
* Add options to hide args and env vars

To allow for use of weave-scope in an unauthenticated environment,
add options to the probe to hide comand line arguments and
environment variables, which might contain secret data.

Fixes #2222

* Change docker.NewRegistry arguments to be a struct

* Remove redundant declarations of default values

* Move registry options outside to improve readability
2017-03-07 08:51:18 -08:00
Alfonso Acosta
c1fa5bb665 Fix kubelet failure fallback and make port configurable 2017-03-07 13:29:02 +00:00
Mike Lang
ed19e7a34b Merge pull request #2197 from weaveworks/mike/ecs/scale-controls
Add ECS Service scale up/down controls
2017-02-21 11:03:01 -08:00
Alfonso Acosta
eb4027a97c Reintroduce probe checkpoint flags for kernel version and OS
Removed unintentionally in https://github.com/weaveworks/scope/pull/2148
2017-02-09 17:29:15 +00:00
Mike Lang
7d58e6a9c3 awsecs: Add dummy scale up and scale down controls for services
These controls do nothing for now, this was just to get the control buttons working
2017-02-07 14:57:31 -08:00
Mike Lang
dee274e438 Merge pull request #2065 from weaveworks/mike/ecs/caching
ECS reporter: Minimize API calls by caching task and service data
2017-01-24 11:03:51 -08:00
Iago López Galeiras
f0d9876258 probe: refactor probeMain 2017-01-23 12:11:35 +01:00
Mike Lang
685af493bf ecs probe: Allow cache settings to be tweaked 2017-01-12 11:37:23 -08:00
Alfonso Acosta
06ff64d477 Forward OS/Kernel version to checkpoint
Useful to prioritize ebpf testing

Also:
* Make treatment of kernel release and version consistent across Darwin/Linux
2016-12-19 20:08:08 +00:00
Mike Lang
7d845f9130 ecs reporter: Review feedback, some trivial renames 2016-12-15 14:11:58 -08:00
Mike Lang
9d1e46f81b ECS reporter: Use persistent client objects across reports
Not only does this allow us to re-use connections, but vitally it allows us
to make use of the new task and service caching within the client object.
2016-12-15 14:11:57 -08:00
Jonathan Lange
e8085b01b6 Use 'common' library 2016-12-07 11:22:38 +00:00
Mike Lang
d0caee4748 Add some basic metadata to the ECS task/service details panels 2016-11-29 07:18:08 -08:00
Alfonso Acosta
ab1d2d2c6d Add checkpoint flag for ECS 2016-11-29 07:18:08 -08:00
Mike Lang
88499b4e9d Add --probe.ecs flag to enable running the ECS probe tagger 2016-11-29 07:17:16 -08:00
Alfonso Acosta
0884955c95 Extend metadata in details panel for Weave Net nodes 2016-11-03 15:57:23 +00:00
Tom Wilkie
7d88279758 Add prometheus metrics endpoint to probes. (#1915) 2016-10-10 14:30:34 -07:00
Tom Wilkie
2a00fd2d78 Allow user to specify URLs on the command line, and use that to allow per-target tokens. (#1901)
Also:
- Parse targets on startup and catch badly formed ones before Scope can start.
- If no port is specified, use default port for scheme; if no scheme is specificed, use 4040.
- Use username as probe token
2016-10-05 10:59:56 -07:00
Tom Wilkie
b130f1ba13 Allow users to specify conntrack buffer size. (#1896)
* Allow users to specify conntrack buffer size.

* Fix tests.

* Use a config struct.
2016-09-26 12:08:38 -07:00
Alfonso Acosta
c5ac315b38 Review feedback 2016-09-20 16:50:29 +00:00
Alfonso Acosta
0223b0b385 Implement DNS snooper 2016-09-19 14:38:59 +00:00
Alfonso Acosta
a904620908 Improve conntrack kernel-support detection for in-kernel compilations 2016-08-26 14:03:29 +00:00
Alfonso Acosta
4cb002e360 Merge pull request #1817 from weaveworks/release-0.17
Release 0.17.1
2016-08-19 15:04:36 +01:00
Alfonso Acosta
f8a67a41f7 Elide sensitive kubernetes flags from the logs 2016-08-18 15:33:07 +00:00
Alfonso Acosta
1bdff95f33 Extend kubernetes client flags to match kubectl 2016-08-17 15:16:58 +00:00
Krzesimir Nowak
1f5dbb776f Add shortcut reports for plugins.
Plugins are queried for reports two times in a second. That's often
enough to get the shortcut reports. The reports are sent together with
the response.
2016-08-12 17:03:42 +02:00
Krzesimir Nowak
0e06423a37 Forward control requests to plugins
Thanks to that, plugins can react to requests from controls they
exposed.

To make it work, plugins registry modifies each plugin's report by
prepending the plugin ID to the control name the plugin has exposed
before sending it to the app. Then the registry installs the control
request handler for this faked control name, which forwards the
request to the correct plugin.

This adds a new API endpoint to plugins next to "/report" - a
"/control" entry. The body of the request is the JSON-encoded
xfer.Request instance.
2016-08-12 17:03:42 +02:00
Krzesimir Nowak
41193b428e Make control handlers registry an object and extend its functionality
It is not a singleton anymore. Instead it is an object with a registry
backend. The default registry backend is provided, which is equivalent
to what used to be before. Custom backend can be provided for testing
purposes.

The registry also supports batch operations to remove and add handlers
as an atomic step.
2016-08-12 17:03:42 +02:00
Alfonso Acosta
276ffa338e Elide service-token when logging commandline arguments 2016-08-11 15:07:08 +00:00
Alfonso Acosta
c0a672c02a Review feedback 2016-07-01 16:51:57 +00:00
Alfonso Acosta
6f1e52cd0d Allow disabling controls in probes 2016-07-01 15:06:06 +00:00
Tom Wilkie
ab3d34be01 Make it easier to disable weave integrations (#1610)
* Make it easier to disable weave integrations

* Review feedback

* Make test pass
2016-06-27 16:11:57 +01:00
Alfonso Acosta
4dfd096ca7 Fix handling of implicit probe targets
Also, clean up entrypoint script.
2016-06-15 11:12:50 +00:00
Alfonso Acosta
a6f8b0a0c6 Add probe version header to probe requests 2016-06-08 13:49:21 +00:00
Tom Wilkie
8f772a696d Add flag to disable reporting of processes (and procspied endpoints) 2016-05-17 17:29:09 +01:00
Alfonso Acosta
1e63d7a23d Add local networks for each k8s service (#1490) 2016-05-12 17:05:22 +01:00
Tom Wilkie
f346ec535c Don't require the user to specify localhost when manually listing hosts 2016-05-12 11:51:47 +01:00
Alfonso Acosta
f34fc2a4df Merge pull request #1410 from weaveworks/1408-dnat-shortlived-connections
Correctly attribute DNAT-ed short-lived connections
2016-05-05 19:37:35 +01:00
Tom Wilkie
9b8f8a6c83 Have probe query kube dns to find the app. 2016-05-05 15:19:44 +01:00
Alfonso Acosta
4140d288a8 Don't scope docker IPs in Kubernetes 2016-05-04 14:50:22 +00:00