Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add makefile targets to automate development on k8s #32348

Closed
ChrsMark opened this issue Apr 12, 2024 · 1 comment · Fixed by #33220
Closed

Add makefile targets to automate development on k8s #32348

ChrsMark opened this issue Apr 12, 2024 · 1 comment · Fixed by #33220
Labels
comp:kubernetes Kubernetes-related components enhancement New feature or request

Comments

@ChrsMark
Copy link
Member

Component(s)

No response

Describe the issue you're reporting

I was wondering if there are any basic development tools/scripts that automate the development process on k8s.
For example, when I want to debug or edit the code of the kubeletstats receiver I need to manually build and load the image on the local cluster and use a very custom values file for the helm chart to be installed using the custom image.
Specifically:

make docker-otelcontribcol && docker tag otelcontribcol otelcontribcol-dev:0.0.1 && kind load docker-image otelcontribcol-dev:0.0.1

and then I use the following values file:

mode: daemonset

image:
  repository: otelcontribcol-dev
  tag: "0.0.1"
  pullPolicy: IfNotPresent

command:
  name: otelcontribcol

clusterRole:
  create: true
  rules:
    - apiGroups:
        - ''
      resources:
        - 'pods'
        - 'nodes'
      verbs:
        - 'get'
        - 'list'
        - 'watch'
    # Only needed if you are using extra_metadata_labels or
    # I
    - apiGroups: [ "" ]
      resources: [ "nodes/proxy"]
      verbs: [ "get" ]


config:
  exporters:
    otlp:
      endpoint: 0.0.0.0:4242
  receivers:
    kubeletstats:
      collection_interval: 10s
      auth_type: 'serviceAccount'
      endpoint: '${env:K8S_NODE_NAME}:10250'
      insecure_skip_verify: true
      k8s_api_config:
        auth_type: serviceAccount
      metrics:
        container.cpu.utilization:
          enabled: true
        container.cpu.time:
          enabled: true
        container.cpu.usage:
          enabled: true
        k8s.container.cpu_limit_utilization:
          enabled: true

  service:
    pipelines:
      metrics:
        receivers: [kubeletstats]
        processors: [batch]
        exporters: [otlp]

and helm install daemonset open-telemetry/opentelemetry-collector --values daemonset_local_k8smetrics.yaml

So I wonder if we could automate this with sth like:

make kind-image
make kind-install-daemonset

This would help to encapsulate all this process and make it easier for new contributors to ramp up.
We can start with sth small and keep adding stuff while we use these targets with the time being.

@TylerHelmuth @jinja2 since you have been working on this area I would like to hear your opinions.

@ChrsMark ChrsMark added the needs triage New item requiring triage label Apr 12, 2024
@crobert-1 crobert-1 added enhancement New feature or request comp:kubernetes Kubernetes-related components labels Apr 12, 2024
@TylerHelmuth
Copy link
Member

Seems reasonable

@crobert-1 crobert-1 removed the needs triage New item requiring triage label Apr 15, 2024
andrzej-stencel pushed a commit that referenced this issue May 22, 2024
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
First attempt for
#32348.

**Link to tracking Issue:** <Issue number if applicable>
#32348

**Testing:** <Describe what testing was performed and which tests were
added.>

**Documentation:** <Describe the documentation added.>

---------

Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
andrzej-stencel added a commit that referenced this issue May 30, 2024
…yment (#33220)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
This PR adds a makefile target for installing a locally built collector
image (on a local k8s kind cluster) in deployment mode.

**Link to tracking Issue:** <Issue number if applicable> 
Fixes
#32348
Follow up of
#32349

**Testing:** <Describe what testing was performed and which tests were
added.>

**Documentation:** <Describe the documentation added.> Added

/cc @andrzej-stencel who reviewed the daemonset target PR

---------

Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:kubernetes Kubernetes-related components enhancement New feature or request
Projects
None yet
3 participants