Skip to content

Commit

Permalink
update promtail to latest version and some changes following the new …
Browse files Browse the repository at this point in the history
…version

Signed-off-by: Vandit Singh <[email protected]>
  • Loading branch information
Vandit1604 committed Oct 2, 2024
1 parent 07e6eb2 commit f0fb1b5
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 9 deletions.
12 changes: 4 additions & 8 deletions prombench/manifests/cluster-infra/6d_promtail_daemon_set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@ data:
client:
batchwait: 1s # Maximum wait period before sending batch
batchsize: 102400 # Maximum batch size to accrue before sending, unit is byte
timeout: 10s # Maximum time to wait for server to respond to a request
backoff_config:
minbackoff: 100ms # Initial backoff time between retries
maxbackoff: 5s # Maximum backoff time between retries
maxretries: 5 # Maximum number of retries when sending batches, 0 means infinite retries
min_period: 100ms # Initial backoff time between retries
max_period: 5s # Maximum backoff time between retries
max_retries: 5 # Maximum number of retries when sending batches, 0 means infinite retries
server:
http_listen_port: 3101
positions:
filename: /run/promtail/positions.yaml
target_config:
sync_period: 10s # Period to resync directories being watched and files being tailed
scrape_configs:
- job_name: kubernetes-pods
kubernetes_sd_configs:
Expand Down Expand Up @@ -80,7 +76,7 @@ spec:
serviceAccountName: promtail
containers:
- name: promtail
image: grafana/promtail:1.4.1
image: grafana/promtail:3.2.0
imagePullPolicy: IfNotPresent
args:
- "-config.file=/etc/promtail/promtail.yaml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ spec:
selector:
app: prometheus
prometheus: test-pr-{{ .PR_NUMBER }}

---
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: promtail-benchtest-config
namespace: prombench-{{ .PR_NUMBER }}
labels:
app: promtail
data:
promtail.yaml: |
client:
batchwait: 1s # Maximum wait period before sending batch
batchsize: 102400 # Maximum batch size to accrue before sending, unit is byte
timeout: 10s # Maximum time to wait for server to respond to a request
backoff_config:
min_period: 100ms # Initial backoff time between retries
max_period: 5s # Maximum backoff time between retries
max_retries: 5 # Maximum number of retries when sending batches, 0 means infinite retries
server:
http_listen_port: 3101
positions:
filename: /run/promtail/positions.yaml
target_config:
sync_period: 10s # Period to resync directories being watched and files being tailed
scrape_configs:
- job_name: kubernetes-pods
kubernetes_sd_configs:
- role: pod
relabel_configs:
- action: keep
source_labels: [__meta_kubernetes_pod_label_app]
regex: prometheus|promtail
- source_labels: [__meta_kubernetes_pod_label_app]
target_label: __service__
- source_labels: [__meta_kubernetes_pod_node_name]
target_label: __host__
- action: replace
replacement: $1
separator: /
source_labels: [__meta_kubernetes_namespace, __service__]
target_label: job
- action: replace
source_labels: [__meta_kubernetes_namespace]
target_label: namespace
- action: replace
source_labels: [__meta_kubernetes_pod_name]
target_label: instance
- action: replace
source_labels: [__meta_kubernetes_pod_container_name]
target_label: container_name
- action: replace
source_labels: [__meta_kubernetes_pod_label_prometheus]
target_label: prometheus
- action: replace
source_labels: [__meta_kubernetes_pod_label_promtail]
target_label: promtail
- replacement: /var/log/pods/*$1/*.log
separator: /
source_labels: [__meta_kubernetes_pod_uid, __meta_kubernetes_pod_container_name]
target_label: __path__
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: promtail-pr-{{ .PR_NUMBER }}
namespace: prombench-{{ .PR_NUMBER }}
labels:
app: promtail
promtail: pr-{{ .PR_NUMBER }}
spec:
replicas: 1
selector:
matchLabels:
app: promtail
promtail: pr-{{ .PR_NUMBER }}
updateStrategy:
type: RollingUpdate
template:
metadata:
namespace: prombench-{{ .PR_NUMBER }}
labels:
app: promtail
promtail: pr-{{ .PR_NUMBER }}
spec:
serviceAccountName: promtail
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchExpressions:
- key: prometheus
operator: In
values:
- test-pr-{{ .PR_NUMBER }}
containers:
- name: promtail
image: grafana/promtail:3.2.0
imagePullPolicy: IfNotPresent
args:
- "-config.file=/etc/promtail/promtail.yaml"
- "-client.url=http://loki.default.svc.cluster.local:3100/api/prom/push"
volumeMounts:
- name: config
mountPath: /etc/promtail
- name: run
mountPath: /run/promtail
- name: pods
mountPath: /var/log/pods
readOnly: true
- name: docker
mountPath: /var/lib/docker/containers
readOnly: true
env:
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
ports:
- containerPort: 3101
name: http-metrics
securityContext:
readOnlyRootFilesystem: true
runAsGroup: 0
runAsUser: 0
readinessProbe:
failureThreshold: 5
httpGet:
path: /ready
port: http-metrics
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
nodeSelector:
node-name: prometheus-{{ .PR_NUMBER }}
isolation: prometheus
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
volumes:
- name: config
configMap:
name: promtail-benchtest-config
- name: run
hostPath:
path: /run/promtail
- name: docker
hostPath:
path: /var/lib/docker/containers
- name: pods
hostPath:
path: /var/log/pods
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: promtail-{{ normalise .RELEASE }}
namespace: prombench-{{ .PR_NUMBER }}
labels:
app: promtail
promtail: {{ normalise .RELEASE }}
spec:
replicas: 1
selector:
matchLabels:
app: promtail
promtail: {{ normalise .RELEASE }}
updateStrategy:
type: RollingUpdate
template:
metadata:
namespace: prombench-{{ .PR_NUMBER }}
labels:
app: promtail
promtail: {{ normalise .RELEASE }}
spec:
serviceAccountName: promtail
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchExpressions:
- key: prometheus
operator: In
values:
- test-{{ normalise .RELEASE }}
containers:
- name: promtail
image: grafana/promtail:3.2.0
imagePullPolicy: IfNotPresent
args:
- "-config.file=/etc/promtail/promtail.yaml"
- "-client.url=http://loki.default.svc.cluster.local:3100/api/prom/push"
volumeMounts:
- name: config
mountPath: /etc/promtail
- name: run
mountPath: /run/promtail
- name: pods
mountPath: /var/log/pods
readOnly: true
- name: docker
mountPath: /var/lib/docker/containers
readOnly: true
env:
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
ports:
- containerPort: 3101
name: http-metrics
securityContext:
readOnlyRootFilesystem: true
runAsGroup: 0
runAsUser: 0
readinessProbe:
failureThreshold: 5
httpGet:
path: /ready
port: http-metrics
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
nodeSelector:
node-name: prometheus-{{ .PR_NUMBER }}
isolation: prometheus
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
volumes:
- name: config
configMap:
name: promtail-benchtest-config
- name: run
hostPath:
path: /run/promtail
- name: docker
hostPath:
path: /var/lib/docker/containers
- name: pods
hostPath:
path: /var/log/pods

0 comments on commit f0fb1b5

Please sign in to comment.