apiVersion: v1 kind: Namespace metadata: name: amazon-cloudwatch labels: name: amazon-cloudwatch --- apiVersion: v1 data: cwagentconfig.json: | { "csm": { "service_addresses": ["udp4://0.0.0.0:31000", "udp6://[::]:31000"], "memory_limit_in_mb": 20 } } kind: ConfigMap metadata: name: service-config namespace: amazon-cloudwatch --- apiVersion: apps/v1 kind: Deployment metadata: name: cloudwatch-agent namespace: amazon-cloudwatch spec: replicas: 1 selector: matchLabels: app: cloudwatch-agent template: metadata: labels: app: cloudwatch-agent spec: containers: - name: cloudwatch-agent image: public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest imagePullPolicy: Always resources: limits: cpu: 200m memory: 100Mi requests: cpu: 200m memory: 100Mi volumeMounts: - name: cwagentconfig mountPath: /etc/cwagentconfig volumes: - name: cwagentconfig configMap: name: service-config terminationGracePeriodSeconds: 10 --- kind: Service apiVersion: v1 metadata: name: cloudwatch-agent namespace: amazon-cloudwatch spec: selector: app: cloudwatch-agent ports: - protocol: UDP port: 31000 targetPort: 31000