Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored the fluentd-es addon files, moved the fluentd configuratio…
…n to ConfigMap
- Loading branch information
Mik Vyatskov
committed
Aug 4, 2017
1 parent
7bc1c67
commit 46f53da
Showing
25 changed files
with
673 additions
and
623 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,82 @@ | ||
# Elasticsearch Add-On | ||
This add-on consists of a combination of | ||
[Elasticsearch](https://www.elastic.co/products/elasticsearch), [Fluentd](http://www.fluentd.org/) | ||
and [Kibana](https://www.elastic.co/products/elasticsearch). Elasticsearch is a search engine | ||
that is responsible for storing our logs and allowing for them to be queried. Fluentd sends | ||
log messages from Kubernetes to Elasticsearch, whereas Kibana is a graphical interface for | ||
viewing and querying the logs stored in Elasticsearch. | ||
|
||
This add-on consists of a combination of [Elasticsearch][elasticsearch], | ||
[Fluentd][fluentd] and [Kibana][kibana]. Elasticsearch is a search engine | ||
that is responsible for storing our logs and allowing for them to be queried. | ||
Fluentd sends log messages from Kubernetes to Elasticsearch, whereas Kibana | ||
is a graphical interface for viewing and querying the logs stored in | ||
Elasticsearch. | ||
|
||
**Note:** this addon should **not** be used as-is in production. This is | ||
an example and you should treat is as such. Please see at least the | ||
[Security](#security) and the [Storage](#storage) sections for more | ||
information. | ||
|
||
## Elasticsearch | ||
Elasticsearch is deployed as a | ||
[StatefulSet](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/), which | ||
is like a Deployment, but allows for maintaining state on storage volumes. | ||
|
||
### Authentication | ||
Elasticsearch has basic authentication enabled by default, in our configuration the credentials | ||
are at their default values, i.e. username 'elastic' and password 'changeme'. In order to change | ||
them, please read up on [the official documentation](https://www.elastic.co/guide/en/x-pack/current/setting-up-authentication.html#reset-built-in-user-passwords). | ||
Elasticsearch is deployed as a [StatefulSet][statefulSet], which is like | ||
a Deployment, but allows for maintaining state on storage volumes. | ||
|
||
### Security | ||
|
||
Elasticsearch has capabilities to enable authorization using | ||
[X-Pack plugin][xPack]. See configuration parameter `xpack.security.enabled` | ||
in Elasticsearch and Kibana configurations. It can also be set via | ||
`XPACK_SECURITY_ENABLED` env variable. After enabling the feature, | ||
follow [official documentation][setupCreds] to set up credentials in | ||
Elasticsearch and Kibana. Don't forget to propagate those credentials also to | ||
Fluentd in its [configuration][fluentdCreds], using for example | ||
[environment variables][fluentdEnvVar]. You can utilize [ConfigMaps][configMap] | ||
and [Secrets][secret] to store credentials in the Kubernetes apiserver. | ||
|
||
### Initialization | ||
|
||
The Elasticsearch Statefulset manifest specifies that there shall be an | ||
[init container](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) executing | ||
before Elasticsearch containers themselves, in order to ensure that the kernel state variable | ||
`vm.max_map_count` is at least 262144, since this is a requirement of Elasticsearch. | ||
You may remove the init container if you know that your host OS meets this requirement. | ||
[init container][initContainer] executing before Elasticsearch containers | ||
themselves, in order to ensure that the kernel state variable | ||
`vm.max_map_count` is at least 262144, since this is a requirement of | ||
Elasticsearch. You may remove the init container if you know that your host | ||
OS meets this requirement. | ||
|
||
### Storage | ||
The Elasticsearch StatefulSet will claim a storage volume 'elasticsearch-logging', | ||
of the standard | ||
[StorageClass](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#storageclasses), | ||
that by default will be 100 Gi per replica. Please adjust this to your needs (including | ||
possibly choosing a more suitable StorageClass). | ||
|
||
The Elasticsearch StatefulSet will use the [EmptyDir][emptyDir] volume to | ||
store data. EmptyDir is erased when the pod terminates, here it is used only | ||
for testing purposes. **Important:** please change the storage to persistent | ||
volume claim before actually using this StatefulSet in your setup! | ||
|
||
## Fluentd | ||
Fluentd is deployed as a | ||
[DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/) which spawns a | ||
pod on each node that reads logs, generated by kubelet, container runtime and containers and | ||
sends them to Elasticsearch. | ||
|
||
*Please note that for Fluentd to work, every Kubernetes node must be labeled* | ||
`beta.kubernetes.io/fluentd-ds-ready=true`, as otherwise Fluentd will ignore them. | ||
Fluentd is deployed as a [DaemonSet][daemonSet] which spawns a pod on each | ||
node that reads logs, generated by kubelet, container runtime and containers | ||
and sends them to Elasticsearch. | ||
|
||
Learn more at: https://kubernetes.io/docs/tasks/debug-application-cluster/logging-elasticsearch-kibana | ||
**Note:** in order for Fluentd to work, every Kubernetes node must be labeled | ||
with `beta.kubernetes.io/fluentd-ds-ready=true`, as otherwise the Fluentd | ||
DaemonSet will ignore them. | ||
|
||
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cluster/addons/fluentd-elasticsearch/README.md?pixel)]() | ||
Learn more in the [official Kubernetes documentation][k8sElasticsearchDocs]. | ||
|
||
### Known problems | ||
|
||
Since Fluentd talks to the Elasticsearch service inside the cluster, instances | ||
on masters won't work, because masters have no kube-proxy. Don't mark masters | ||
with a label mentioned in the previous paragraph or add a taint on them to | ||
avoid Fluentd pods scheduling there. | ||
|
||
[fluentd]: http://www.fluentd.org/ | ||
[elasticsearch]: https://www.elastic.co/products/elasticsearch | ||
[kibana]: https://www.elastic.co/products/kibana | ||
[xPack]: https://www.elastic.co/products/x-pack | ||
[setupCreds]: https://www.elastic.co/guide/en/x-pack/current/setting-up-authentication.html#reset-built-in-user-passwords | ||
[fluentdCreds]: https://github.com/uken/fluent-plugin-elasticsearch#user-password-path-scheme-ssl_verify | ||
[fluentdEnvVar]: https://docs.fluentd.org/v0.12/articles/faq#how-can-i-use-environment-variables-to-configure-parameters-dynamically | ||
[configMap]: https://kubernetes.io/docs/tasks/configure-pod-container/configmap/ | ||
[secret]: https://kubernetes.io/docs/concepts/configuration/secret/ | ||
[statefulSet]: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset | ||
[initContainer]: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ | ||
[emptyDir]: https://kubernetes.io/docs/concepts/storage/volumes#emptydir | ||
[daemonSet]: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ | ||
[k8sElasticsearchDocs]: https://kubernetes.io/docs/tasks/debug-application-cluster/logging-elasticsearch-kibana | ||
|
||
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cluster/addons/fluentd-elasticsearch/README.md?pixel)]() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
cluster/addons/fluentd-elasticsearch/es-clusterrolebinding.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
cluster/addons/fluentd-elasticsearch/es-serviceaccount.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
cluster/addons/fluentd-elasticsearch/fluentd-es-clusterrole.yaml
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
cluster/addons/fluentd-elasticsearch/fluentd-es-clusterrolebinding.yaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
@crassirostris - what was the rationale behind disabling xpack features here? Shouldn't these be override-able just like minimum_master_nodes?