Skip to content
Snippets Groups Projects
Commit ffa07c0c authored by Xiang Dai's avatar Xiang Dai Committed by Tom Wilkie
Browse files

tools/promtail.sh: add DATAROOT option (#98)


* tools/promatail.sh: add DATAROOT option

Signed-off-by: default avatarXiang Dai <764524258@qq.com>

* ksonnet: support custom data root

Signed-off-by: default avatarXiang Dai <764524258@qq.com>

* Move dataroot setting to $._config.promtail_config.dataroot

* whitespace fix

* Update promtail.libsonnet
parent a2e4f7c2
No related branches found
No related tags found
No related merge requests found
......@@ -45,10 +45,12 @@ promtail + {
hostname: 'logs-us-west1.grafana.net',
username: 'user-id',
password: 'password',
dataroot: '/var/lib/docker',
},
},
}
```
Notice that `dataroot` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it.
Then do `ks show loki` to see the manifests that'll be deployed to your cluster.
Apply them using `ks apply loki`.
......@@ -79,13 +81,15 @@ loki + promtail + gateway {
scheme: 'http',
hostname: 'gateway.%(namespace)s.svc' % $._config,
username: 'loki',
password: 'password'
password: 'password',
dataroot: '/var/lib/docker',
},
replication_factor: 3,
consul_replicas: 1,
},
}
```
Notice that `dataroot` is your own data root for docker daemon, use `docker info | grep "Root Dir"` to get it.
Do `ks show loki` to see the manifests being deployed to the cluster.
Finally `ks apply loki` to deploy the server components to your cluster.
......@@ -12,6 +12,7 @@ k {
password: '',
scheme: 'https',
hostname: 'log-us.grafana.net',
dataroot: '/var/lib/docker',
},
......@@ -184,5 +185,5 @@ k {
daemonSet.mixin.spec.template.spec.withServiceAccount('promtail') +
$.util.configVolumeMount('promtail', '/etc/promtail') +
$.util.hostVolumeMount('varlog', '/var/log', '/var/log') +
$.util.hostVolumeMount('varlibdockercontainers', '/var/lib/docker/containers', '/var/lib/docker/containers', readOnly=true),
$.util.hostVolumeMount('varlibdockercontainers', $._config.promtail_config.dataroot + '/containers', '/var/lib/docker/containers', readOnly=true),
}
......@@ -4,9 +4,10 @@ INSTANCEID="${1:-}"
APIKEY="${2:-}"
INSTANCEURL="${3:-}"
NAMESPACE="${4:-default}"
DATAROOT="${5-/var/lib/docker}"
if [ -z "$INSTANCEID" -o -z "$APIKEY" -o -z "$INSTANCEURL" -o -z "$NAMESPACE" ]; then
echo "usage: $0 <instanceId> <apiKey> <url> <namespace>"
if [ -z "$INSTANCEID" -o -z "$APIKEY" -o -z "$INSTANCEURL" -o -z "$NAMESPACE" -o -z "$DATAROOT" ]; then
echo "usage: $0 <instanceId> <apiKey> <url> <namespace> <dataroot>"
exit 1
fi
......@@ -134,7 +135,7 @@ spec:
path: /var/log
name: varlog
- hostPath:
path: /var/lib/docker/containers
path: <dataroot>/containers
name: varlibdockercontainers
updateStrategy:
type: RollingUpdate
......@@ -182,3 +183,4 @@ echo "$TEMPLATE" | sed \
-e "s#<apiKey>#${APIKEY}#" \
-e "s#<instanceUrl>#${INSTANCEURL}#" \
-e "s#<namespace>#${NAMESPACE}#"
-e "s#<dataroot>#${DATAROOT}#"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment