Skip to content

Instantly share code, notes, and snippets.

@SamLiu79
Created November 21, 2017 11:35
Show Gist options
  • Save SamLiu79/1f1b2768351591ff9e0f14769c3f0edf to your computer and use it in GitHub Desktop.
Save SamLiu79/1f1b2768351591ff9e0f14769c3f0edf to your computer and use it in GitHub Desktop.
influxdb deployment
---
# influxdb 配置文件
Version: v1
kind: ConfigMap
metadata:
name: v1-influxdb
labels:
app: v1-influxdb
chart: "influxdb-0.4.2"
release: "v1"
heritage: "Tiller"
data:
influxdb.conf: |+
reporting-disabled = false
bind-address = ":8088"
[meta]
dir = "/var/lib/influxdb/meta"
retention-autocreate = true
logging-enabled = true
[data]
dir = "/var/lib/influxdb/data"
wal-dir = "/var/lib/influxdb/wal"
query-log-enabled = true
cache-max-memory-size = 1073741824
cache-snapshot-memory-size = 26214400
cache-snapshot-write-cold-duration = "10m0s"
compact-full-write-cold-duration = "4h0m0s"
max-series-per-database = 1000000
max-values-per-tag = 100000
trace-logging-enabled = false
[coordinator]
write-timeout = "10s"
max-concurrent-queries = 0
query-timeout = "0s"
log-queries-after = "0s"
max-select-point = 0
max-select-series = 0
max-select-buckets = 0
[retention]
enabled = true
check-interval = "30m0s"
[shard-precreation]
enabled = true
check-interval = "10m0s"
advance-period = "30m0s"
[admin]
enabled = false
bind-address = ":8083"
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"
[monitor]
store-enabled = true
store-database = "_internal"
store-interval = "10s"
[subscriber]
enabled = true
http-timeout = "30s"
insecure-skip-verify = false
ca-certs = ""
write-concurrency = 40
write-buffer-size = 1000
[http]
enabled = true
bind-address = ":8086"
auth-enabled = false
log-enabled = true
write-tracing = false
pprof-enabled = true
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"
https-private-key = ""
max-row-limit = 10000
max-connection-limit = 0
shared-secret = "beetlejuicebeetlejuicebeetlejuice"
realm = "InfluxDB"
unix-socket-enabled = false
bind-socket = "/var/run/influxdb.sock"
[[graphite]]
enabled = false
bind-address = ":2003"
database = "graphite"
retention-policy = "autogen"
protocol = "tcp"
batch-size = 5000
batch-pending = 10
batch-timeout = "1s"
consistency-level = "one"
separator = "."
udp-read-buffer = 0
[[collectd]]
enabled = false
bind-address = ":25826"
database = "collectd"
retention-policy = "autogen"
batch-size = 5000
batch-pending = 10
batch-timeout = "10s"
read-buffer = 0
typesdb = "/usr/share/collectd/types.db"
security-level = "none"
auth-file = "/etc/collectd/auth_file"
[[opentsdb]]
enabled = false
bind-address = ":4242"
database = "opentsdb"
retention-policy = "autogen"
consistency-level = "one"
tls-enabled = false
certificate = "/etc/ssl/influxdb.pem"
batch-size = 1000
batch-pending = 5
batch-timeout = "1s"
log-point-errors = true
[[udp]]
enabled = false
bind-address = ":8089"
database = "udp"
retention-policy = "autogen"
batch-size = 5000
batch-pending = 10
read-buffer = 0
batch-timeout = "1s"
precision = "ns"
[continuous_queries]
log-enabled = true
enabled = true
run-interval = "1s"
---
# 部署 influxdb, 默认 replicas=1
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: v1-influxdb
labels:
app: v1-influxdb
chart: "influxdb-0.4.2"
release: "v1"
heritage: "Tiller"
spec:
replicas: 1
template:
metadata:
labels:
app: v1-influxdb
spec:
containers:
- name: v1-influxdb
image: "influxdb:1.2-alpine"
imagePullPolicy: "IfNotPresent"
resources:
limits:
cpu: 8
memory: 16Gi
requests:
cpu: 0.1
memory: 256Mi
ports:
- name: api
containerPort: 8086
# liveness probe 设置 初始化延迟30秒, 默认连接超时5秒, 连接端口为8086
livenessProbe:
httpGet:
path: /ping
port: api
initialDelaySeconds: 30
timeoutSeconds: 5
#
readinessProbe:
httpGet:
path: /ping
port: api
initialDelaySeconds: 5
timeoutSeconds: 1
volumeMounts:
- name: data
mountPath: /var/lib/influxdb
- name: config
mountPath: /etc/influxdb
volumes:
- name: data
persistentVolumeClaim:
claimName: v1-influxdb
- name: config
configMap:
name: v1-influxdb
---
# 创建 PVC, 请根据storage-class 做相应修改
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: "v1-influxdb"
labels:
app: "v1-influxdb"
chart: "influxdb-0.4.2"
release: "v1"
heritage: "Tiller"
annotations:
volume.alpha.kubernetes.io/storage-class: default
spec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: "8Gi"
---
# 创建 influxdb 服务
apiVersion: v1
kind: Service
metadata:
name: v1-influxdb
labels:
app: v1-influxdb
chart: "influxdb-0.4.2"
release: "v1"
heritage: "Tiller"
spec:
type: ClusterIP
ports:
- name: api
port: 8086
targetPort: 8086
selector:
app: v1-influxdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment