I am tried to config promtail 3.3.0 to send kubernetes pod log to loki in kubernetes like this:
server:
disable: true
positions:
filename: /tmp/positions.yaml
clients:
- url: http://129.114.36.24:3100/loki/api/v1/push
scrape_configs:
- job_name: 'kubernetes-pods'
kubernetes_sd_configs:
- role: pod
and this is the deamonset config:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: promtail-daemonset
namespace: default
uid: a7801cf9-3f88-4c36-b6a7-0f523db14476
resourceVersion: '23969692'
generation: 16
creationTimestamp: '2024-11-26T13:11:46Z'
labels:
k8slens-edit-resource-version: v1
status:
currentNumberScheduled: 1
numberMisscheduled: 0
desiredNumberScheduled: 1
numberReady: 1
observedGeneration: 16
updatedNumberScheduled: 1
numberAvailable: 1
spec:
selector:
matchLabels:
name: promtail
template:
metadata:
creationTimestamp: null
labels:
name: promtail
annotations:
kubectl.kubernetes.io/restartedAt: '2024-11-30T04:29:04Z'
spec:
volumes:
- name: machine-id
hostPath:
path: /etc/machine-id
type: ''
- name: logs
hostPath:
path: /var/log
type: ''
- name: journal
hostPath:
path: /var/log/journal
type: ''
- name: journal-run
hostPath:
path: /run/log/journal
type: ''
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
type: ''
- name: promtail-config
configMap:
name: promtail-config
defaultMode: 420
containers:
- name: promtail-container
image: registry.cn-qingdao.aliyuncs.com/reddwarf-public/promtail:3.2.0
args:
- '-config.file=/etc/promtail/promtail.yaml'
- ‘-log.level=trace’
env:
- name: iZm5e2jhfbrshckqh6qdbuZ
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
resources: {}
volumeMounts:
- name: machine-id
mountPath: /etc/machine-id
- name: journal-run
mountPath: /run/log/journal
- name: journal
mountPath: /var/log/journal
- name: logs
mountPath: /var/log
- name: promtail-config
mountPath: /etc/promtail
- name: varlibdockercontainers
readOnly: true
mountPath: /var/lib/docker/containers
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccountName: promtail-serviceaccount
serviceAccount: promtail-serviceaccount
securityContext: {}
schedulerName: default-scheduler
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 0
revisionHistoryLimit: 10
the promtail did not send any logs to loki, am I missing something?