-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Setting up MetricBeat on Digital Ocean Kubernetes service. Even with … #315
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
jenkins test this please |
Had to see the integration tests run to understand how they worked- should be working now. |
jenkins test this please |
metricbeat/values.yaml
Outdated
replicas: 1 | ||
|
||
# Use host networking so that metricbeat can get hostname and talk to kubelet | ||
hostNetworking: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default value should be false (see #321 (comment))
@@ -7,19 +7,36 @@ metricbeatConfig: | |||
hostfs: /hostfs | |||
metricbeat.modules: | |||
- module: kubernetes | |||
labels.dedot: true | |||
annotations.dedot: true | |||
add_metadata: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any specific reason to replace add_kubernetes_metadata
processor by module kubernetes metadata?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR come from following the given directions and not getting any metrics. In the process of trying to get it working, I noticed that the config in the helmchart didn't match https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-kubernetes.html and changing it was one of a number of things I did to get it working. I know that the dedot
stuff was necessary. It is possible that I just misunderstood something though- I assumed the helm config simply hadn't kept up to date with the metricbeat settings... but if this isn't right, happy to change it back :)
When we are deploying metricbeat we would only need the hostNetwork enabled on the daemonset and not the deployment since that is just pulling metrics from remote endpoints. |
Good point- I'll get in there and update this a bit today. |
b69debd
to
ebb1f7a
Compare
So, I switched the default to false and split the setting in two. Let me know if the actual default config should be changed back- I don't know well enough to have an opinion, just copy/paste from the docs :) As a note- the latest version of attrs 19.2 has a conflict with the version of pytest here |
hey guys, just wondering when is this change going to get merged? |
jenkins test this please |
…`host: ${NODE}` the metrics were coming through incorrectly. I wound up collecting a bunch of config changes as I read the documentation more carefully. The manifest from the beat repo suggests Host Networking. DO requires the secured kubelet port with the hostname for certificate validation. The dedot processer is necessary if you have labels or annotations with dots in the name. Not being a metricbeat expert, let me know if something is incorrect.
ebb1f7a
to
3643a88
Compare
fixed the merge conflict |
handle deployment/daemonset separately
3643a88
to
1d4f633
Compare
jenkins test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pbecotte,
Many thanks for your PR. However, there is too much change in this PR.
I tried a few time to analyze the impacts of these changes for every current users to decide if we should include them and have good arguments if we shouldn't include them but it's beyond my Metricbeat knowledge.
I think this PR should include the changes related to hostNetworking
as you already did in #321 (with hostNetwork default value set to false for daemonset and deployment off course).
As for all the other changes (disable add_kubernetes_metadata
processor and manage add_metadata
inside kubernetes
module, add dedots
option, ...), I don't think they will fit every use cases for current users.
As you're not sure about what is really needed in your use case, I would recommend you to try using default values with only hostNetworking enabled in a first time, then to apply the other changes (one by one and only if it resolve your issues) in your overrided value file.
If we have other feedbacks mentioning that these values are mandatory for metricbeat specifically on DOKS, we may provide a DOKS example config in the same way that we are providing docker-for-mac
, kubernetes-kind
, minikube
or openshift
examples for Elasticsearch chart
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | | ||
| `metricbeatConfig` | Allows you to add any config files in `/usr/share/metricbeat` such as `metricbeat.yml`. See [values.yaml](./values.yaml) for an example of the formatting with the default configuration. | see [values.yaml](./values.yaml) | | ||
| `extraEnvs` | Extra [environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config) which will be appended to the `env:` definition for the container | `[]` | | ||
| `hostNetworking` | Use host networking for the deployment and daemonset to give better visibility into where the system is running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this one could also be renamed to hostDaemonsetNetworking
@@ -1,2 +1,4 @@ | |||
pytest==4.1.0 | |||
PyYAML==4.2b4 | |||
# attrs 19.2 not compatable with pytest 4.1 | |||
attrs < 19.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't need that as pip automatically install a version compatible with pytest 4.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, except pytest 4.1 has its dependency at "attrs>=17.4.0"
, so it will happily pull in the latest version, which happened to introduce a breaking change.
That is obviously up to you- I had the changes to get this working already, so I figured I'd open a PR. If you don't want to use them, it is completely possible that you know better than I do :) However- I didn't just go in and randomly start changing stuff. When I brought up the elastic stack, I had no metrics of any sort related to my k8s cluster. It wasn't one thing wrong, there was a series.
So, that's a long way of saying- the two changes I made (pulling in the config from the metricbeat docs, enabling host networking) were both necessary. (The third change was pulling the NODE_NAME stuff over to the kube-state-metrics deployment. Probably could be removed, it was kind of a hail mary on getting the daemonset metric hostnames to work correctly, but it also seemed like it should be there to match filebeat and the like). Either way, thanks for your time- and even if it doesn't get merged, having this in here will probably help someone who hits similar issues in the future. |
Despite a lot of use cases don't require / aren't compatible with As for the other changes:
The existing settings are working well with GKE which is the provider we are using for our automated tests as well as for using this Helm chart in production on 20-30 GKE clusters. These default settings don't try to be compatible with every use cases and k8s providers, that's why Helm default values are overridable and the whole metricbeat config can be and should be fully customized to fit specific needs using I stay with the recommendation of keeping only |
Fair enough, I'm revisiting this today. |
host: ${NODE}
the metrics were coming through with the pod names. I wound up making a bunch of config changes to update things in accordance with the latest documentation. The final issue was no insecure kubelet port on Digital Ocean, so I added a bit of comments about that situation. Let me know if I misunderstood something here.${CHART}/tests/*.py
${CHART}/examples/*/test/goss.yaml