Skip to content

Migrate kubernetes module - #70

Merged
exekias merged 23 commits into
elastic:masterfrom
ChrsMark:migrate_k8s
Jun 30, 2020
Merged

Migrate kubernetes module#70
exekias merged 23 commits into
elastic:masterfrom
ChrsMark:migrate_k8s

Conversation

@ChrsMark

@ChrsMark ChrsMark commented Jun 11, 2020

Copy link
Copy Markdown
Member

Implementing Kubernetes package migration
Important Notes:

  1. container, system, node, pod, volume metricsets require access to the Kubelet API. Usually these are enabled when Metricbeat is deployed as Daemonset on k8s nodes.
  2. state_* metricsets require the deployment kube-state-metrics on the k8s cluster in order to retrieve metrics from it.
  3. apiserver, scheduler, proxy and controllermanager require access to each component of the k8s cluster accordingly.

Wondering how all these would be possible in combination with agent. Do we need to define how agent will run in k8s (deployment, daemonset) in order to make it work? @exekias do you have anything in mind about this?

Docs: https://www.elastic.co/guide/en/beats/metricbeat/master/metricbeat-module-kubernetes.html

Migration Steps:

  • docker-compose -f snapshot.yml -f local.yml up --force-recreate
  • PACKAGES=kubernetes mage ImportBeats
  • icon check
  • Review titles and descriptions in manifest files
  • add docs/README.md
  • screenshots check
  • check spelling
  • Review fields file and exported fields in docs
  • Metricbeat: add missing configuration options
  • Define all variable properties
  • use stream.dataset field instead of event.dataset

Screenshots

Screenshot 2020-06-26 at 13 01 04
Screenshot 2020-06-26 at 12 59 05
Screenshot 2020-06-26 at 12 57 41
Screenshot 2020-06-26 at 12 58 45

Manual Testing

  1. Using the testing env introduced at Add k8s manifests to deploy stack along with Agent #89 we spin up the Stack and Agent on a k8s cluster.
  2. For the 2 different configs (see Add k8s manifests to deploy stack along with Agent #89) enable the Package once for node scope Agent and once for cluster scope.
  3. Verify that all datasets are shipping metrics and Dashboards are being populated.
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
@elasticmachine

elasticmachine commented Jun 11, 2020

Copy link
Copy Markdown

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Branch indexing]

  • Start Time: 2020-06-29T17:25:26.637+0000

  • Duration: 4 min 49 sec

Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
@mtojek
mtojek marked this pull request as draft June 12, 2020 06:51
ChrsMark added 2 commits June 17, 2020 11:24
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
ChrsMark added 6 commits June 24, 2020 12:14
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
@ChrsMark

Copy link
Copy Markdown
Member Author

@exekias @mtojek this one seems to be completed in terms of "package migration". Would love your feedback here.

Manual testing is also possible already (using https://github.com/elastic/integrations-dev/issues/58) in order to verify that data are being collected and Dashboards work ok.

We still need to verify what will happen with Agent's side regarding docs and manifests around the Deployment strategies on k8s.

@mtojek

mtojek commented Jun 24, 2020

Copy link
Copy Markdown
Contributor

I think you can convert it to ordinary pull-request. Thanks for the contribution.

@ChrsMark
ChrsMark marked this pull request as ready for review June 25, 2020 07:22
@mtojek mtojek changed the title [WIP] Migrate kubernetes module Jun 25, 2020

@exekias exekias left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't test it, but it looks good. I think we need to improve docs, left a comment on that regard

@@ -0,0 +1,38 @@
title: Kubernetes apiserver metrics

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: Kubernetes apiserver metrics
title: Kubernetes API Server metrics
Comment on lines +37 to +38
title: Kubernetes apiserver metrics
description: Collect Kubernetes apiserver metrics

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: Kubernetes apiserver metrics
description: Collect Kubernetes apiserver metrics
title: Kubernetes API Server metrics
description: Collect Kubernetes API Server metrics

This integration is used to collect metrics from
[Kubernetes clusters](https://kubernetes.io/).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing many of the explanations that we have here: https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-kubernetes.html

It would be nice to provide good understanding on the variety of datasets that we have and how they need to be configured

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Added!

ChrsMark added 3 commits June 25, 2020 14:24
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
@ChrsMark

Copy link
Copy Markdown
Member Author

Updated the Docs and changed the sample json events with new ones according to the new indexing approach.

@@ -0,0 +1,2 @@
- name: kubernetes
type: group

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that according to latest changes in import-beat, pushed by @kaiyan-sheng , this empty file is not required.

@@ -0,0 +1,2 @@
- name: kubernetes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -0,0 +1 @@
metricsets: ["event"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need any configuration options? There is even no "period" defined hence wondering.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the configuration manually in the manifest.yml and missed that. 👍

@@ -0,0 +1,44 @@
title: Kubernetes Node metrics
release: experimental

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adjusts all release fields. We will release all new packages as "beta".

show_user: true
default:
- kube-state-metrics:8080
title: Kubernetes state_resourcequota metrics

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can update the title to a pleasant, human-readable form (no underscore).

Comment thread packages/kubernetes/manifest.yml Outdated
format_version: 1.0.0
name: kubernetes
title: Kubernetes
version: 0.0.1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version: 0.1.0

Comment thread packages/kubernetes/manifest.yml Outdated
requirement:
kibana:
versions: '>=7.3.0 <8.0.0'
elasticsearch: {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field (elasticsearch) can be removed.

Comment thread packages/kubernetes/manifest.yml Outdated
categories:
- metrics
release: beta
removable: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field too.

Comment thread packages/kubernetes/manifest.yml Outdated
description: Collect metrics from Kubernetes
inputs:
- type: kubernetes/metrics
title: Collect Kubernetes API Server, Container, Controller Manager, Event, Node, Pod, Proxy, Scheduler, state_container, state_cronjob, state_deployment, state_node, state_persistentvolume, state_persistentvolumeclaim, state_pod, state_replicaset, state_resourcequota, state_service, state_statefulset, state_storageclass, System and Volume metrics

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can shorten this one :D

simply - Collect Kubernetes metrics?

Comment thread packages/kubernetes/manifest.yml Outdated
inputs:
- type: kubernetes/metrics
title: Collect Kubernetes API Server, Container, Controller Manager, Event, Node, Pod, Proxy, Scheduler, state_container, state_cronjob, state_deployment, state_node, state_persistentvolume, state_persistentvolumeclaim, state_pod, state_replicaset, state_resourcequota, state_service, state_statefulset, state_storageclass, System and Volume metrics
description: Collecting API Server, Container, Controller Manager, Event, Node, Pod, Proxy, Scheduler, state_container, state_cronjob, state_deployment, state_node, state_persistentvolume, state_persistentvolumeclaim, state_pod, state_replicaset, state_resourcequota, state_service, state_statefulset, state_storageclass, System and Volume metrics from Kubernetes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that all captions, descriptions, etc. should present names which are human readable (no underscores).

@mtojek

mtojek commented Jun 26, 2020

Copy link
Copy Markdown
Contributor

Just noticed on screenshots, please improve case sensitivity on screenshots.

ChrsMark added 4 commits June 26, 2020 11:50
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
@ChrsMark

Copy link
Copy Markdown
Member Author

Thanks for the review @mtojek! Comments should be addressed now.

@ChrsMark
ChrsMark requested a review from mtojek June 26, 2020 09:13

@mtojek mtojek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, Christos!

ChrsMark added 2 commits June 26, 2020 12:41
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
@ChrsMark

ChrsMark commented Jun 26, 2020

Copy link
Copy Markdown
Member Author

@exekias @andresrc this integration is completed. Tested manually using testing/environments/kubernetes. Let me know if we can merge/ship it already or we want to wait for a Running Agent on k8s part on Agent's side.

@mtojek

mtojek commented Jun 30, 2020

Copy link
Copy Markdown
Contributor

@ChrsMark

I think you have to merge this PR, otherwise you'll have to rebase against the master branch, as there are some breaking changes coming: #132

@exekias

exekias commented Jun 30, 2020

Copy link
Copy Markdown

++ Let's get this in. I think it would be nice to follow up with docs on the Agent side on how to deploy in Kubernetes

Merging this on behalf of @ChrsMark, as he is off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Integration:kubernetes Kubernetes New Integration Issue or pull request for creating a new integration package.

5 participants