-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d41cca6
commit 303f105
Showing
31 changed files
with
749 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localbin/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ARG BUILD_IMAGE=ubuntu:latest | ||
|
||
# Install cert and binaries | ||
FROM $BUILD_IMAGE as build | ||
|
||
# Need to repeat the ARG after each FROM | ||
ARG TARGETARCH | ||
|
||
RUN mkdir -p /opt/aws/amazon-cloudwatch-agent/etc | ||
RUN mkdir -p /opt/aws/amazon-cloudwatch-agent/var | ||
RUN mkdir -p /opt/aws/amazon-cloudwatch-agent/bin | ||
COPY tmp/${TARGETARCH} /opt/aws/amazon-cloudwatch-agent/bin | ||
RUN apt-get update && \ | ||
apt-get install -y ca-certificates && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
FROM scratch | ||
|
||
COPY --from=build /tmp /tmp | ||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY --from=build /opt/aws/amazon-cloudwatch-agent /opt/aws/amazon-cloudwatch-agent | ||
|
||
ENV RUN_IN_CONTAINER="True" | ||
ENTRYPOINT ["/opt/aws/amazon-cloudwatch-agent/bin/start-amazon-cloudwatch-agent"] |
7 changes: 7 additions & 0 deletions
7
amazon-cloudwatch-container-insights/k8s-yaml-templates/cloudwatch-dev-namespace.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# create amazon-cloudwatch namespace | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: amazon-cloudwatch-dev | ||
labels: | ||
name: amazon-cloudwatch-dev |
7 changes: 7 additions & 0 deletions
7
amazon-cloudwatch-container-insights/k8s-yaml-templates/cloudwatch-latest-namespace.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# create amazon-cloudwatch namespace | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: amazon-cloudwatch | ||
labels: | ||
name: amazon-cloudwatch |
24 changes: 24 additions & 0 deletions
24
...sights/k8s-yaml-templates/cwagent-dev-kubernetes-monitoring-onprem/cwagent-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# create configmap for cwagent 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": { | ||
"region": "us-west-2", | ||
"debug": true | ||
}, | ||
"logs": { | ||
"metrics_collected": { | ||
"kubernetes": { | ||
"cluster_name": "cwagent-dev-kubernetes-monitoring-onprem" | ||
} | ||
}, | ||
"force_flush_interval": 5 | ||
} | ||
} | ||
kind: ConfigMap | ||
metadata: | ||
name: cwagentconfig | ||
namespace: amazon-cloudwatch-dev |
12 changes: 12 additions & 0 deletions
12
.../k8s-yaml-templates/cwagent-dev-kubernetes-monitoring-onprem/cwagent-creds-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# create configmap for cwagent creds | ||
apiVersion: v1 | ||
data: | ||
# Configuration is in aws creds format for on prem | ||
credentials: | | ||
[AmazonCloudWatchAgent] | ||
aws_access_key_id = ${your aws_access_key_id} | ||
aws_secret_access_key = ${enter you aws_secret_access_key here} | ||
kind: ConfigMap | ||
metadata: | ||
name: creds | ||
namespace: amazon-cloudwatch-dev |
97 changes: 97 additions & 0 deletions
97
...sights/k8s-yaml-templates/cwagent-dev-kubernetes-monitoring-onprem/cwagent-daemonset.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# deploy cwagent as daemonset | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: cloudwatch-agent | ||
namespace: amazon-cloudwatch-dev | ||
spec: | ||
selector: | ||
matchLabels: | ||
name: cloudwatch-agent | ||
template: | ||
metadata: | ||
labels: | ||
name: cloudwatch-agent | ||
spec: | ||
containers: | ||
- name: cloudwatch-agent | ||
image: ${enter your dev image here} | ||
imagePullPolicy: Always | ||
#ports: | ||
# - containerPort: 8125 | ||
# hostPort: 8125 | ||
# protocol: UDP | ||
resources: | ||
limits: | ||
cpu: 200m | ||
memory: 200Mi | ||
requests: | ||
cpu: 200m | ||
memory: 200Mi | ||
# Please don't change below envs | ||
env: | ||
- name: HOST_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.hostIP | ||
- name: HOST_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
- name: K8S_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: CI_VERSION | ||
value: "k8s/1.0.1" | ||
# Please don't change the mountPath | ||
volumeMounts: | ||
- name: cwagentconfig | ||
mountPath: /etc/cwagentconfig | ||
- name: creds | ||
mountPath: /root/.aws/credentials | ||
- name: rootfs | ||
mountPath: /rootfs | ||
readOnly: true | ||
- name: dockersock | ||
mountPath: /var/run/docker.sock | ||
readOnly: true | ||
- name: varlibdocker | ||
mountPath: /var/lib/docker | ||
readOnly: true | ||
- name: containerdsock | ||
mountPath: /run/containerd/containerd.sock | ||
readOnly: true | ||
- name: sys | ||
mountPath: /sys | ||
readOnly: true | ||
- name: devdisk | ||
mountPath: /dev/disk | ||
readOnly: true | ||
volumes: | ||
- name: cwagentconfig | ||
configMap: | ||
name: cwagentconfig | ||
- name: creds | ||
configMap: | ||
name: creds | ||
- name: rootfs | ||
hostPath: | ||
path: / | ||
- name: dockersock | ||
hostPath: | ||
path: /var/run/docker.sock | ||
- name: varlibdocker | ||
hostPath: | ||
path: /var/lib/docker | ||
- name: containerdsock | ||
hostPath: | ||
path: /run/containerd/containerd.sock | ||
- name: sys | ||
hostPath: | ||
path: /sys | ||
- name: devdisk | ||
hostPath: | ||
path: /dev/disk/ | ||
terminationGracePeriodSeconds: 60 | ||
serviceAccountName: cloudwatch-agent |
46 changes: 46 additions & 0 deletions
46
...s/k8s-yaml-templates/cwagent-dev-kubernetes-monitoring-onprem/cwagent-serviceaccount.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# create cwagent service account and role binding | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: cloudwatch-agent | ||
namespace: amazon-cloudwatch-dev | ||
|
||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: cloudwatch-agent-role | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["pods", "nodes", "endpoints"] | ||
verbs: ["list", "watch"] | ||
- apiGroups: ["apps"] | ||
resources: ["replicasets"] | ||
verbs: ["list", "watch"] | ||
- apiGroups: ["batch"] | ||
resources: ["jobs"] | ||
verbs: ["list", "watch"] | ||
- apiGroups: [""] | ||
resources: ["nodes/proxy"] | ||
verbs: ["get"] | ||
- apiGroups: [""] | ||
resources: ["nodes/stats", "configmaps", "events"] | ||
verbs: ["create"] | ||
- apiGroups: [""] | ||
resources: ["configmaps"] | ||
resourceNames: ["cwagent-clusterleader"] | ||
verbs: ["get","update"] | ||
|
||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: cloudwatch-agent-role-binding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: cloudwatch-agent | ||
namespace: amazon-cloudwatch-dev | ||
roleRef: | ||
kind: ClusterRole | ||
name: cloudwatch-agent-role | ||
apiGroup: rbac.authorization.k8s.io |
24 changes: 24 additions & 0 deletions
24
...hts/k8s-yaml-templates/cwagent-latest-kubernetes-monitoring-onprem/cwagent-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# create configmap for cwagent 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": { | ||
"region": "us-west-2", | ||
"debug": true | ||
}, | ||
"logs": { | ||
"metrics_collected": { | ||
"kubernetes": { | ||
"cluster_name": "cwagent-latest-kubernetes-monitoring-onprem" | ||
} | ||
}, | ||
"force_flush_interval": 5 | ||
} | ||
} | ||
kind: ConfigMap | ||
metadata: | ||
name: cwagentconfig | ||
namespace: amazon-cloudwatch |
12 changes: 12 additions & 0 deletions
12
...s-yaml-templates/cwagent-latest-kubernetes-monitoring-onprem/cwagent-creds-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# create configmap for cwagent creds | ||
apiVersion: v1 | ||
data: | ||
# Configuration is in aws creds format for on prem | ||
credentials: | | ||
[AmazonCloudWatchAgent] | ||
aws_access_key_id = ${your aws_access_key_id} | ||
aws_secret_access_key = ${enter you aws_secret_access_key here} | ||
kind: ConfigMap | ||
metadata: | ||
name: creds | ||
namespace: amazon-cloudwatch |
Oops, something went wrong.