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: # this is the your demo app docker image imagePullPolicy: Always env: - name: AWS_CSM_ENABLED value: "true" - name: AWS_CSM_PORT value: "31000" - name: AWS_CSM_HOST value: "127.0.0.1" - name: cloudwatch-agent image: public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest imagePullPolicy: Always env: - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name 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" } } }, "logs": { "metrics_collected": { "emf": {} } }, "csm": { "service_addresses": ["udp4://127.0.0.1:31000", "udp6://[::1]:31000"], "memory_limit_in_mb": 20 } } kind: ConfigMap metadata: name: cwagentconfig-sidecar