Skip to content

Commit

Permalink
Initial k8s commit
Browse files Browse the repository at this point in the history
Initial k8s commit

adding resource limits
  • Loading branch information
fmdlc committed Oct 21, 2020
1 parent 9d4ff68 commit 6fddfb0
Show file tree
Hide file tree
Showing 7 changed files with 3,329 additions and 0 deletions.
Empty file added kubernetes/README.md
Empty file.
133 changes: 133 additions & 0 deletions kubernetes/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: monitoring
name: network-dashboard-provisioner
data:
networking.yaml: |-
apiVersion: 1
providers:
- name: 'ISP-Checker'
orgId: 1
folder: ''
type: file
disableDeletion: true
editable: false
options:
path: /tmp/dashboard/network-dashboard.json
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: monitoring
name: telegraf-config
data:
telegraf.conf: |+
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
hostname = ""
omit_hostname = false
debug = false
[[outputs.influxdb]]
urls = ["http://influxdb:8086"]
database = "$INFLUXDB_DB"
timeout = "60s"
username = "$INFLUXDB_ADMIN_USER"
password = "$INFLUXDB_ADMIN_PASSWORD"
user_agent = "telegraf"
skip_database_creation = false
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
[[inputs.dns_query]]
servers = ["4.2.2.1", "8.8.8.8"]
domains = ["www.google.com", "www.twitter.com", "www.amazon.com", "www.wikipedia.org"]
record_type = "A"
port = 53
timeout = 3
[[inputs.http_response]]
urls = [
"http://www.google.com",
"http://www.twitter.com",
"http://www.amazon.com",
"http://www.yahoo.com"
]
response_timeout = "5s"
method = "GET"
follow_redirects = true
[[inputs.internal]]
collect_memstats = true
[[inputs.linux_sysctl_fs]]
[[inputs.net]]
[[inputs.netstat]]
[[inputs.ping]]
urls = [
"google.com",
"twitter.com",
"amazon.com",
"yahoo.com"
]
method = "exec"
count = 1
ping_interval = 1.0
timeout = 5.0
deadline = 10
binary = "ping"
ipv6 = false
[[inputs.exec]]
commands=["mtr -C google.com s3-website.ap-northeast-2.amazonaws.com s3-website.eu-central-1.amazonaws.com s3-website.af-south-1.amazonaws.com"]
timeout = "3m"
interval = "7m"
data_format = "csv"
csv_skip_rows = 1
csv_column_names=[ "", "", "status","dest","hop","ip","loss","snt","", "","avg","best","worst","stdev"]
name_override = "mtr"
csv_tag_columns = ["dest", "hop", "ip"]
[[inputs.exec]]
commands = ["/usr/bin/speedtest-cli --csv --bytes"]
name_override = "speedtest"
timeout = "3m"
interval = "15m"
data_format = "csv"
csv_column_names = ['Server ID','Sponsor','Server Name','Timestamp','Distance','Ping','Download','Upload','Share','IP Address']
csv_timestamp_column = "Timestamp"
csv_timestamp_format = "2006-01-02T15:04:05Z07:00"
161 changes: 161 additions & 0 deletions kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: monitoring
name: influxdb
labels:
app: influxdb
spec:
replicas: 1
selector:
matchLabels:
app: influxdb
template:
metadata:
labels:
app: influxdb
spec:
containers:
- name: influxdb
image: influxdb:1.8.3
imagePullPolicy: IfNotPresent
envFrom:
- secretRef:
name: isp-checker-secrets
ports:
- containerPort: 8086
readinessProbe:
httpGet:
path: /ping
port: 8086
volumeMounts:
- mountPath: /var/lib/influxdb
name: var-lib-influxdb
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1024Mi"
cpu: "500m"
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: var-lib-influxdb
persistentVolumeClaim:
claimName: influxdb-pvc

---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: monitoring
name: grafana
labels:
app: grafana
spec:
replicas: 1
progressDeadlineSeconds: 600
selector:
matchLabels:
app: grafana
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: grafana
spec:
containers:
- name: grafana
image: grafana/grafana:7.2.1
imagePullPolicy: IfNotPresent
envFrom:
- secretRef:
name: isp-checker-secrets
volumeMounts:
- name: grafana-datasource-provisioner
mountPath: /etc/grafana/provisioning/datasources/datasource.yaml
subPath: datasource.yaml
readOnly: true
- name: grafana-dashboard-provisioner
mountPath: /etc/grafana/provisioning/dashboards/networking.yaml
subPath: networking.yaml
readOnly: true
- name: grafana-dashboard-data
mountPath: /tmp/dashboard/network-dashboard.json
subPath: network-dashboard.json
ports:
- containerPort: 3000
env:
- name: GF_INSTALL_PLUGINS
value: https://grafana.com/api/plugins/gowee-traceroutemap-panel/versions/0.2.3/download;gowee-traceroutemap-panel
readinessProbe:
httpGet:
path: /
port: 3000
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1024Mi"
cpu: "500m"
volumes:
- name: grafana-datasource-provisioner
secret:
secretName: grafana-datasource
- name: grafana-dashboard-provisioner
configMap:
name: network-dashboard-provisioner
- name: grafana-dashboard-data
configMap:
name: network-dashboard-data
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: monitoring
name: telegraf
labels:
app: telegraf
spec:
replicas: 1
selector:
matchLabels:
app: telegraf
template:
metadata:
labels:
app: telegraf
spec:
containers:
- name: telegraf
image: tty0/isp_telegraf:1.15.3
envFrom:
- secretRef:
name: isp-checker-secrets
imagePullPolicy: IfNotPresent
volumeMounts:
- name: telegraf-config-volume
mountPath: /etc/telegraf/telegraf.conf
subPath: telegraf.conf
readOnly: true
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1024Mi"
cpu: "500m"
volumes:
- name: telegraf-config-volume
configMap:
name: telegraf-config
4 changes: 4 additions & 0 deletions kubernetes/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: monitoring
Loading

0 comments on commit 6fddfb0

Please sign in to comment.