apiVersion: apps/v1 kind: Deployment metadata: name: demo-app # the name of the deployment spec: replicas: 1 # tells deployment to run 1 pods matching the template selector: matchLabels: name: demo-app template: # create pods using pod definition in this template metadata: labels: name: demo-app spec: containers: - name: demo-app image: alpine/socat:latest command: ["/bin/sh"] args: ["-c", "while true; do echo 'statsdTestMetric:1|c' | socat -v -t 0 - UDP:127.0.0.1:8125; sleep 1; done"] imagePullPolicy: Always - name: cloudwatch-agent image: public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest imagePullPolicy: Always resources: limits: cpu: 100m memory: 100Mi requests: cpu: 32m memory: 24Mi volumeMounts: - name: cwagentconfig mountPath: /etc/cwagentconfig volumes: - name: cwagentconfig configMap: name: cwagentconfig-sidecar --- # create configmap for cwagent sidecar config 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-sidecar