Skip to content

Commit fa3ef7c

Browse files
author
Jonathan Chauncey
committed
Merge pull request #28 from jchauncey/logger
docs(logging): Add documentation about platform logging
2 parents e0c5dbb + 2b7367d commit fa3ef7c

3 files changed

Lines changed: 114 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ lib64
1616

1717
# python virtual environments for testing
1818
venv/
19+
20+
_build/

src/installing-deis/quickstart.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ Choose one of the following providers and deploy a new kubernetes cluster:
1414
- [Google Container Engine](https://cloud.google.com/container-engine/docs/before-you-begin)
1515
- [Vagrant](http://kubernetes.io/v1.1/docs/getting-started-guides/vagrant.html)
1616

17+
## Prerequisites
18+
Please make sure you enable the Daemon Sets api if you are installing a pre-1.2 version of kubernetes. As it is not turned on by default. You can learn more about how to do that [here](http://kubernetes.io/v1.1/docs/api.html#enabling-resources-in-the-extensions-group).
19+
20+
For example, with a CoreOS kubernetes cluster you can edit the api server unit file and add the following line to the `ExecStart` stanza: `--runtime_config=extensions/v1beta1=true,extensions/v1beta1/daemonsets=true`.
21+
22+
Restart your api server and check that the extensions api is enabled:
23+
24+
```
25+
$ kubectl api-versions
26+
$ extensions/v1beta1
27+
```
28+
1729
## Install Deis Platform
1830

1931
Now that you've finished provisioning a cluster, please [Install the Deis Platform][install deis].
Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,102 @@
11
# Platform Logging
22

3-
TODO (bacongobbler): rewrite for v2
3+
**You must have the Daemon Sets api enabled for the logging system to work. To learn more visit [here](https://github.com/kubernetes/kubernetes/blob/master/docs/api.md#enabling-resources-in-the-extensions-group).**
4+
5+
## Description
6+
The logging platform is made up of 2 components - [Fluentd](https://github.com/deis/fluentd) and [Logger](https://github.com/deis/logger).
7+
8+
[Fluentd](https://github.com/deis/fluentd) runs on every minion node of the cluster and is deployed as a [Daemons Set](http://kubernetes.io/v1.1/docs/admin/daemons.html). The Fluentd pods capture all of the stderr and stdout streams of every container running on the host (even those not hosted directly by kubernetes). It then sends this data via the Syslog UDP port (514) to the Logger component.
9+
10+
Logger acts like a syslog server and receives all log messages that are occurring on the cluster. It then filters this data to only Deis deploy applications and stores those log messages in a ring buffer where they can be fetched via the Deis CLI.
11+
12+
## Installation
13+
Installation of the logging components is separate from the installation of the Deis platform because of the requirement of Daemon Sets. You will need to follow these steps to get the logging components running on your kubernetes cluster.
14+
15+
```
16+
$ helm fetch deis/deis-logger
17+
$ helm install deis-logger
18+
```
19+
20+
You will then need to watch the components come up and verify they are in a running state by executing the following command:
21+
22+
```
23+
$ kubectl get pods --namespace=deis
24+
```
25+
26+
You should see output similar to this:
27+
```
28+
NAME READY STATUS RESTARTS AGE
29+
deis-builder-m68z9 1/1 Running 0 18h
30+
deis-database-y765n 1/1 Running 0 1d
31+
deis-logger-fluentd-pcndf 1/1 Running 0 20h
32+
deis-logger-iwos5 1/1 Running 0 20h
33+
deis-minio-zlmk8 1/1 Running 0 1d
34+
deis-registry-bys9n 1/1 Running 0 1d
35+
deis-router-h5f0i 1/1 Running 0 1d
36+
deis-workflow-2v84b 1/1 Running 0 20h
37+
```
38+
39+
There should be a fluentd pod per minion node of your Kubernetes cluster. So if you are running a 3 node cluster with 1 master and 2 minions you will have 2 fluentd pods running.
40+
41+
Once you have verified that the pods have started correctly you will need to restart your workflow pod so that it can capture the correct information about how to talk to the logger pod.
42+
43+
```
44+
kubectl delete pod <deis-workflow-pod>
45+
```
46+
47+
The replication controller will restart a new pod with all of the correct information.
48+
49+
Once the pod has restarted, you can verify the logging system is working by going to a deployed app and executing the `deis logs` command. If an error occurs the CLI will print a user friendly message about how to debug the issue.
50+
51+
```
52+
Error: There are currently no log messages. Please check the following things:
53+
1) Logger and fluentd pods are running.
54+
2) If you just installed the logger components via the chart, please make sure you restarted the workflow pod.
55+
3) The application is writing logs to the logger component.
56+
You can verify that logs are appearing in the logger component by issuing the following command:
57+
curl http://<log service ip>:8088/logs/myapp on a kubernetes host.
58+
To get the service ip you can do the following: kubectl get svc deis-logger --namespace=deis
59+
```
60+
61+
## Architecture Diagram
62+
```
63+
┌──────────────┐
64+
│ │
65+
│ Host ├─────┐
66+
│ Fluentd│ │
67+
└──────────────┘ UDP
68+
69+
┌──────────────┐ │ ┌──────────────┐
70+
│ │ │ │ Logger │
71+
│ Host │─UDP─┼─────▶│ Host │
72+
│ Fluentd│ │ │ Fluentd │
73+
└──────────────┘ │ └──────────────┘
74+
┌──────────────┐ │
75+
│ │ UDP
76+
│ Host │─────┘
77+
│ Fluentd│
78+
└──────────────┘
79+
```
80+
81+
## Default Configuration
82+
By default the Fluentd pod can be configured to talk to numerous syslog endpoints. So for example it is possible to have Fluentd send log messages to both the Logger component and [Papertrail](https://papertrailapp.com/). This allows production deployments of Deis to satisfy stringent logging requirements such as offsite backups of log data.
83+
84+
Configuring Fluentd to talk to multiple syslog endpoints means adding the following stanzas to the Fluentd daemonset manifest -
85+
86+
```
87+
env:
88+
- name: "SYSLOG_HOST_1"
89+
value: $(DEIS_LOGGER_SERVICE_HOST)
90+
- name: "SYSLOG_PORT_1"
91+
value: $(DEIS_LOGGER_SERVICE_PORT_TRANSPORT)
92+
- name: "SYSLOG_HOST_2"
93+
value: "my.syslog.host.2"
94+
- name: "SYSLOG_PORT_2"
95+
value: "5144"
96+
....
97+
- name: "SYSLOG_HOST_N"
98+
value: "my.syslog.host.n"
99+
- name: "SYSLOG_PORT_N"
100+
value: "51333"
101+
```
102+

0 commit comments

Comments
 (0)