# create amazon-cloudwatch namespace apiVersion: v1 kind: Namespace metadata: name: amazon-cloudwatch labels: name: amazon-cloudwatch --- # Daemonset apiVersion: apps/v1 kind: DaemonSet metadata: name: cloudwatch-agent namespace: amazon-cloudwatch spec: selector: matchLabels: name: cloudwatch-agent template: metadata: labels: name: cloudwatch-agent spec: containers: - name: cloudwatch-agent image: public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest imagePullPolicy: Always ports: # containerPort should be consistent with the listen port defined in configmap - containerPort: 8125 hostPort: 8125 protocol: UDP resources: limits: cpu: 200m memory: 100Mi requests: cpu: 200m memory: 100Mi # Please don't change the mountPath volumeMounts: - name: cwagentconfig mountPath: /etc/cwagentconfig volumes: - name: cwagentconfig configMap: name: cwagentconfig terminationGracePeriodSeconds: 60 --- # Configmap apiVersion: v1 data: # Configuration is in Json format. No matter what configure change you make, # please keep the Json blob valid. cwagentconfig.json: | { "agent": { "omit_hostname": true }, "metrics": { "metrics_collected": { "statsd": { "service_address":":8125" } } } } kind: ConfigMap metadata: name: cwagentconfig namespace: amazon-cloudwatch