Coder Social home page Coder Social logo

wangzlei / amazon-cloudwatch-agent-operator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws/amazon-cloudwatch-agent-operator

0.0 0.0 0.0 5.4 MB

The Amazon CloudWatch Agent Operator is software developed to manage the CloudWatch Agent on kubernetes.

License: Apache License 2.0

Go 96.81% Makefile 1.19% Smarty 0.71% HCL 1.13% Dockerfile 0.15%

amazon-cloudwatch-agent-operator's Introduction

Amazon CloudWatch Agent Operator

The Amazon CloudWatch Agent Operator is software developed to manage the CloudWatch Agent on kubernetes.

This repo is based off of the OpenTelemetry Operator

Build and Deployment

  • Image can be built using make container
  • Deploy kubernetes objects to your cluster make deploy

Pre requisites

  1. Have an existing kubernetes cluster, such as minikube

  2. Install cert-manager on your cluster

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.0/cert-manager.yaml

Getting started

  1. Set a shortcut for kubectl for the operator namespace
kubectl config set-context --current --namespace=amazon-cloudwatch
  1. Look at all resources created
kubectl get all
  1. Look at the manager pod logs to ensure the manager is functioning and waiting for workers
kubectl logs amazon-cloudwatch-agent-operator-controller-manager-66f67f47f78

You should see logs that look similar to below

{"level":"info","ts":"2023-06-29T01:37:36Z","msg":"Starting workers","controller":"amazoncloudwatchagent","controllerGroup":"cloudwatch.aws.amazon.com","controllerKind":"AmazonCloudWatchAgent","worker count":1}
  1. Create an AmazonCloudWatchAgent resource
kubectl apply -f - <<EOF
apiVersion: cloudwatch.aws.amazon.com/v1alpha1
kind: AmazonCloudWatchAgent
metadata:
  name: cloudwatch-agent
  namespace: amazon-cloudwatch
spec:
  mode: daemonset
  serviceAccount: cloudwatch-agent
  config: |
    {
        // insert cloudwatch agent config here
    }
  volumeMounts:
  - mountPath: /rootfs
    name: rootfs
    readOnly: true
  - mountPath: /var/run/docker.sock
    name: dockersock
    readOnly: true
  - mountPath: /run/containerd/containerd.sock
    name: containerdsock
  - mountPath: /var/lib/docker
    name: varlibdocker
    readOnly: true
  - mountPath: /sys
    name: sys
    readOnly: true
  - mountPath: /dev/disk
    name: devdisk
    readOnly: true
  volumes:
  - name: rootfs
    hostPath:
      path: /
  - hostPath:
      path: /var/run/docker.sock
    name: dockersock
  - hostPath:
      path: /var/lib/docker
    name: varlibdocker
  - hostPath:
      path: /run/containerd/containerd.sock
    name: containerdsock
  - hostPath:
      path: /sys
    name: sys
  - hostPath:
      path: /dev/disk/
    name: devdisk
  env:
    - name: K8S_NODE_NAME
      valueFrom:
        fieldRef:
          fieldPath: spec.nodeName
    - name: HOST_IP
      valueFrom:
        fieldRef:
          fieldPath: status.hostIP
    - name: HOST_NAME
      valueFrom:
        fieldRef:
          fieldPath: spec.nodeName
    - name: K8S_NAMESPACE
      valueFrom:
        fieldRef:
          fieldPath: metadata.namespace
EOF
  1. Create Instrumentation resource
kubectl apply -f - <<EOF
apiVersion: cloudwatch.aws.amazon.com/v1alpha1
kind: Instrumentation
metadata:
  name: java-instrumentation
  namespace: default # use a namespace with pods you'd like to inject
spec:
  exporter:
    endpoint: http://cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics
  propagators:
    - tracecontext
    - baggage
    - b3
    - xray
  java:
    env:
      - name: OTEL_METRICS_EXPORTER
        value: "none"
      - name: OTEL_LOGS_EXPORTER
        value: "none"
      - name: OTEL_AWS_APP_SIGNALS_ENABLED
        value: "true"
      - name: OTEL_EXPORTER_OTLP_PROTOCOL
        value: "http/protobuf"
      - name: OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT
        value: "http://cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics"
EOF

Helpful tools

  1. This package uses kubebuilder markers to generate kubernetes configs. Run make manifests to create crds and roles in config/crd and config/rbac
  2. Generate deepcopy.go by running make generate

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

amazon-cloudwatch-agent-operator's People

Contributors

dependabot[bot] avatar pavolloffay avatar jpkrohling avatar yuriolisa avatar jaronoff97 avatar lisguo avatar iblancasa avatar vineethreddy02 avatar swiatekm-sumo avatar tylerhelmuth avatar opentelemetrybot avatar avadhut123pisal avatar frzifus avatar kielek avatar mat-rumian avatar matej-g avatar kevinearls avatar ishwarkanse avatar anuraaga avatar changexd avatar kristinapathak avatar chrlic avatar moh-osman3 avatar mitali-salvi avatar nathalapooja avatar wangzlei avatar bhiravabhatla avatar jefchien avatar bogdandrutu avatar sky333999 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.