add(promtail): add our own promtail dependency App (#1394)
* add(promtail): add our own promtail dependency App * try using an initcontainer to softlink shizzle * linting * hmm * hmm * without init * no RO * hmm * hmm * hmm no tol? * set tag * env gone * no daemonset * hmm * ok * dupe * fallback error message instead of exit 1 * hmm * the things obviously needs root
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
appVersion: "0.52.1"
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
repository: https://truecharts.org
|
||||||
|
version: 8.9.3
|
||||||
|
deprecated: false
|
||||||
|
description: Promtail is an agent which ships the contents of local logs to a Loki instance
|
||||||
|
icon: https://raw.githubusercontent.com/grafana/loki/master/docs/sources/logo.png
|
||||||
|
home: https://github.com/truecharts/apps/tree/master/charts/stable/prometheus
|
||||||
|
keywords:
|
||||||
|
- metrics
|
||||||
|
- logs
|
||||||
|
kubeVersion: '>=1.16.0-0'
|
||||||
|
maintainers:
|
||||||
|
- email: info@truecharts.org
|
||||||
|
name: TrueCharts
|
||||||
|
url: https://truecharts.org
|
||||||
|
name: promtail
|
||||||
|
sources:
|
||||||
|
- https://github.com/grafana/loki
|
||||||
|
- https://grafana.com/oss/loki/
|
||||||
|
- https://grafana.com/docs/loki/latest/
|
||||||
|
type: application
|
||||||
|
version: 0.0.1
|
||||||
|
annotations:
|
||||||
|
truecharts.org/catagories: |
|
||||||
|
- metrics
|
||||||
|
- logs
|
||||||
|
truecharts.org/SCALE-support: "true"
|
||||||
|
truecharts.org/grade: U
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
# Include{groups}
|
||||||
|
portals: {}
|
||||||
|
questions:
|
||||||
|
|
||||||
|
- variable: service
|
||||||
|
group: "Networking and Services"
|
||||||
|
label: "Configure Service(s)"
|
||||||
|
schema:
|
||||||
|
type: dict
|
||||||
|
attrs:
|
||||||
|
- variable: main
|
||||||
|
label: "Main Service"
|
||||||
|
description: "The serving the Prometheus WebUI"
|
||||||
|
schema:
|
||||||
|
type: dict
|
||||||
|
attrs:
|
||||||
|
# Include{serviceSelector}
|
||||||
|
- variable: main
|
||||||
|
label: "Main Service Port Configuration"
|
||||||
|
schema:
|
||||||
|
type: dict
|
||||||
|
attrs:
|
||||||
|
- variable: port
|
||||||
|
label: "Port"
|
||||||
|
description: "This port exposes the container port on the service"
|
||||||
|
schema:
|
||||||
|
type: int
|
||||||
|
default: 3101
|
||||||
|
required: true
|
||||||
|
- variable: advanced
|
||||||
|
label: "Show Advanced settings"
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
show_subquestions_if: true
|
||||||
|
subquestions:
|
||||||
|
- variable: enabled
|
||||||
|
label: "Enable the port"
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
- variable: protocol
|
||||||
|
label: "Port Type"
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
default: "HTTP"
|
||||||
|
enum:
|
||||||
|
- value: HTTP
|
||||||
|
description: "HTTP"
|
||||||
|
- value: "HTTPS"
|
||||||
|
description: "HTTPS"
|
||||||
|
- value: TCP
|
||||||
|
description: "TCP"
|
||||||
|
- value: "UDP"
|
||||||
|
description: "UDP"
|
||||||
|
- variable: nodePort
|
||||||
|
label: "Node Port (Optional)"
|
||||||
|
description: "This port gets exposed to the node. Only considered when service type is NodePort, Simple or LoadBalancer"
|
||||||
|
schema:
|
||||||
|
type: int
|
||||||
|
min: 9000
|
||||||
|
max: 65535
|
||||||
|
- variable: targetPort
|
||||||
|
label: "Target Port"
|
||||||
|
description: "The internal(!) port on the container the Application runs on"
|
||||||
|
schema:
|
||||||
|
type: int
|
||||||
|
default: 3101
|
||||||
|
|
||||||
|
- variable: serviceexpert
|
||||||
|
group: "Networking and Services"
|
||||||
|
label: "Show Expert Config"
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
show_subquestions_if: true
|
||||||
|
subquestions:
|
||||||
|
- variable: hostNetwork
|
||||||
|
group: "Networking and Services"
|
||||||
|
label: "Host-Networking (Complicated)"
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
# Include{serviceExpert}
|
||||||
|
|
||||||
|
# Include{serviceList}
|
||||||
|
|
||||||
|
# Include{persistenceList}
|
||||||
|
|
||||||
|
- variable: ingress
|
||||||
|
label: ""
|
||||||
|
group: "Ingress"
|
||||||
|
schema:
|
||||||
|
type: dict
|
||||||
|
attrs:
|
||||||
|
- variable: main
|
||||||
|
label: "Main Ingress"
|
||||||
|
schema:
|
||||||
|
type: dict
|
||||||
|
attrs:
|
||||||
|
# Include{ingressDefault}
|
||||||
|
|
||||||
|
# Include{ingressTLS}
|
||||||
|
|
||||||
|
# Include{ingressTraefik}
|
||||||
|
|
||||||
|
# Include{ingressExpert}
|
||||||
|
|
||||||
|
# Include{ingressList}
|
||||||
|
|
||||||
|
# Include{advanced}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
{{/* Render the templates */}}
|
||||||
|
{{ include "common.all" . }}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: promtail-config
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels" . | nindent 4 }}
|
||||||
|
stringData:
|
||||||
|
promtail.yaml: |
|
||||||
|
{{- tpl .Values.config.file . | nindent 4 }}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{{- if .Values.serviceMonitor.enabled }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . -}}
|
||||||
|
{{- with .Values.serviceMonitor.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.serviceMonitor.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.serviceMonitor.namespaceSelector }}
|
||||||
|
namespaceSelector:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "common.labels.selectorLabels" . | nindent 6 }}
|
||||||
|
endpoints:
|
||||||
|
- port: http-metrics
|
||||||
|
{{- with .Values.serviceMonitor.interval }}
|
||||||
|
interval: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.serviceMonitor.scrapeTimeout }}
|
||||||
|
scrapeTimeout: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,273 @@
|
|||||||
|
image:
|
||||||
|
repository: grafana/promtail
|
||||||
|
tag: v2.3.0@sha256:1e8554cdac6681f877d10a2a383d8fcc2f475188914282ccf86722c2e23c501c
|
||||||
|
|
||||||
|
# controller:
|
||||||
|
# # -- Set the controller type.
|
||||||
|
# # Valid options are deployment, daemonset or statefulset
|
||||||
|
# type: daemonset
|
||||||
|
|
||||||
|
args:
|
||||||
|
- "-config.file=/etc/promtail/promtail.yaml"
|
||||||
|
|
||||||
|
envValueFrom:
|
||||||
|
HOSTNAME:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: spec.nodeName
|
||||||
|
|
||||||
|
service:
|
||||||
|
main:
|
||||||
|
ports:
|
||||||
|
main:
|
||||||
|
targetPort: 3101
|
||||||
|
port: 3101
|
||||||
|
probes:
|
||||||
|
liveness:
|
||||||
|
path: "/ready"
|
||||||
|
|
||||||
|
readiness:
|
||||||
|
path: "/ready"
|
||||||
|
|
||||||
|
startup:
|
||||||
|
path: "/ready"
|
||||||
|
|
||||||
|
initContainers:
|
||||||
|
link-logs:
|
||||||
|
image: "{{ .Values.alpineImage.repository}}:v3.14.2@sha256:4095394abbae907e94b1f2fd2e2de6c4f201a5b9704573243ca8eb16db8cdb7c"
|
||||||
|
command:
|
||||||
|
- "sh"
|
||||||
|
- "-c"
|
||||||
|
- mkdir -p /var/lib/docker/link && ln -sf $(cat /etc/docker/daemon.json | jq -r '."data-root"')/containers/ /var/lib/docker/link/ || echo "cannot symlink container logs"
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /etc/docker/
|
||||||
|
name: docker
|
||||||
|
- mountPath: /var/lib/docker/link/containers
|
||||||
|
name: containers
|
||||||
|
|
||||||
|
# -- The security context for pods
|
||||||
|
podSecurityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
runAsGroup: 0
|
||||||
|
|
||||||
|
# -- The security context for containers
|
||||||
|
securityContext:
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
runAsNonRoot: false
|
||||||
|
|
||||||
|
persistence:
|
||||||
|
docker:
|
||||||
|
enabled: true
|
||||||
|
type: hostPath
|
||||||
|
mountPath: /etc/docker/
|
||||||
|
hostPath: /etc/docker/
|
||||||
|
readOnly: true
|
||||||
|
containers:
|
||||||
|
enabled: true
|
||||||
|
type: hostPath
|
||||||
|
mountPath: /var/lib/docker/link/containers
|
||||||
|
hostPath: /var/lib/docker/link/containers
|
||||||
|
readOnly: true
|
||||||
|
pods:
|
||||||
|
enabled: true
|
||||||
|
type: hostPath
|
||||||
|
mountPath: /var/log/pods
|
||||||
|
hostPath: /var/log/pods
|
||||||
|
readOnly: true
|
||||||
|
run:
|
||||||
|
enabled: true
|
||||||
|
type: hostPath
|
||||||
|
mountPath: /run/promtail
|
||||||
|
hostPath: /run/promtai
|
||||||
|
config:
|
||||||
|
enabled: true
|
||||||
|
type: secret
|
||||||
|
objectName: "promtail-config"
|
||||||
|
mountPath: /etc/promtail
|
||||||
|
|
||||||
|
|
||||||
|
# -- Whether Role Based Access Control objects like roles and rolebindings should be created
|
||||||
|
rbac:
|
||||||
|
enabled: true
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- nodes
|
||||||
|
- nodes/proxy
|
||||||
|
- services
|
||||||
|
- endpoints
|
||||||
|
- pods
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- watch
|
||||||
|
- list
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
# -- Specifies whether a ServiceAccount should be created
|
||||||
|
create: true
|
||||||
|
|
||||||
|
# -- Tolerations for pods. By default, pods will be scheduled on master/control-plane nodes.
|
||||||
|
tolerations:
|
||||||
|
- key: node-role.kubernetes.io/master
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
|
- key: node-role.kubernetes.io/control-plane
|
||||||
|
operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
|
|
||||||
|
# ServiceMonitor configuration
|
||||||
|
serviceMonitor:
|
||||||
|
# -- If enabled, ServiceMonitor resources for Prometheus Operator are created
|
||||||
|
enabled: false
|
||||||
|
# -- Alternative namespace for ServiceMonitor resources
|
||||||
|
namespace: null
|
||||||
|
# -- Namespace selector for ServiceMonitor resources
|
||||||
|
namespaceSelector: {}
|
||||||
|
# -- ServiceMonitor annotations
|
||||||
|
annotations: {}
|
||||||
|
# -- Additional ServiceMonitor labels
|
||||||
|
labels: {}
|
||||||
|
# -- ServiceMonitor scrape interval
|
||||||
|
interval: null
|
||||||
|
# -- ServiceMonitor scrape timeout in Go duration format (e.g. 15s)
|
||||||
|
scrapeTimeout: null
|
||||||
|
|
||||||
|
# -- Section for crafting Promtails config file. The only directly relevant value is `config.file`
|
||||||
|
# which is a templated string that references the other values and snippets below this key.
|
||||||
|
# @default -- See `values.yaml`
|
||||||
|
config:
|
||||||
|
# -- The log level of the Promtail server
|
||||||
|
# Must be reference in `config.file` to configure `server.log_level`
|
||||||
|
# See default config in `values.yaml`
|
||||||
|
logLevel: info
|
||||||
|
# -- The port of the Promtail server
|
||||||
|
# Must be reference in `config.file` to configure `server.http_listen_port`
|
||||||
|
# See default config in `values.yaml`
|
||||||
|
serverPort: 3101
|
||||||
|
# -- The Loki address to post logs to.
|
||||||
|
# Must be reference in `config.file` to configure `client.url`.
|
||||||
|
# See default config in `values.yaml`
|
||||||
|
lokiAddress: ""
|
||||||
|
# -- A section of reusable snippets that can be reference in `config.file`.
|
||||||
|
# Custom snippets may be added in order to reduce redundancy.
|
||||||
|
# This is especially helpful when multiple `kubernetes_sd_configs` are use which usually have large parts in common.
|
||||||
|
# @default -- See `values.yaml`
|
||||||
|
snippets:
|
||||||
|
pipelineStages:
|
||||||
|
- cri: {}
|
||||||
|
common:
|
||||||
|
- action: replace
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_pod_node_name
|
||||||
|
target_label: node_name
|
||||||
|
- action: replace
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_namespace
|
||||||
|
target_label: namespace
|
||||||
|
- action: replace
|
||||||
|
replacement: $1
|
||||||
|
separator: /
|
||||||
|
source_labels:
|
||||||
|
- namespace
|
||||||
|
- app
|
||||||
|
target_label: job
|
||||||
|
- action: replace
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_pod_name
|
||||||
|
target_label: pod
|
||||||
|
- action: replace
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_pod_container_name
|
||||||
|
target_label: container
|
||||||
|
- action: replace
|
||||||
|
replacement: /var/log/pods/*$1/*.log
|
||||||
|
separator: /
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_pod_uid
|
||||||
|
- __meta_kubernetes_pod_container_name
|
||||||
|
target_label: __path__
|
||||||
|
- action: replace
|
||||||
|
replacement: /var/log/pods/*$1/*.log
|
||||||
|
regex: true/(.*)
|
||||||
|
separator: /
|
||||||
|
source_labels:
|
||||||
|
- __meta_kubernetes_pod_annotationpresent_kubernetes_io_config_hash
|
||||||
|
- __meta_kubernetes_pod_annotation_kubernetes_io_config_hash
|
||||||
|
- __meta_kubernetes_pod_container_name
|
||||||
|
target_label: __path__
|
||||||
|
|
||||||
|
# If set to true, adds an additional label for the scrape job.
|
||||||
|
# This helps debug the Promtail config.
|
||||||
|
addScrapeJobLabel: false
|
||||||
|
|
||||||
|
# -- You can put here any keys that will be directly added to the config file's 'client' block.
|
||||||
|
# @default -- empty
|
||||||
|
extraClientConfigs: ""
|
||||||
|
|
||||||
|
# -- You can put here any additional scrape configs you want to add to the config file.
|
||||||
|
# @default -- empty
|
||||||
|
extraScrapeConfigs: ""
|
||||||
|
|
||||||
|
# -- You can put here any additional relabel_configs to "kubernetes-pods" job
|
||||||
|
extraRelabelConfigs: []
|
||||||
|
|
||||||
|
scrapeConfigs: |
|
||||||
|
# See also https://github.com/grafana/loki/blob/master/production/ksonnet/promtail/scrape_config.libsonnet for reference
|
||||||
|
- job_name: kubernetes-pods
|
||||||
|
pipeline_stages:
|
||||||
|
{{- toYaml .Values.config.snippets.pipelineStages | nindent 4 }}
|
||||||
|
kubernetes_sd_configs:
|
||||||
|
- role: pod
|
||||||
|
relabel_configs:
|
||||||
|
- source_labels:
|
||||||
|
- __meta_kubernetes_pod_controller_name
|
||||||
|
regex: ([0-9a-z-.]+?)(-[0-9a-f]{8,10})?
|
||||||
|
action: replace
|
||||||
|
target_label: __tmp_controller_name
|
||||||
|
- source_labels:
|
||||||
|
- __meta_kubernetes_pod_label_app_kubernetes_io_name
|
||||||
|
- __meta_kubernetes_pod_label_app
|
||||||
|
- __tmp_controller_name
|
||||||
|
- __meta_kubernetes_pod_name
|
||||||
|
regex: ^;*([^;]+)(;.*)?$
|
||||||
|
action: replace
|
||||||
|
target_label: app
|
||||||
|
- source_labels:
|
||||||
|
- __meta_kubernetes_pod_label_app_kubernetes_io_component
|
||||||
|
- __meta_kubernetes_pod_label_component
|
||||||
|
regex: ^;*([^;]+)(;.*)?$
|
||||||
|
action: replace
|
||||||
|
target_label: component
|
||||||
|
{{- if .Values.config.snippets.addScrapeJobLabel }}
|
||||||
|
- replacement: kubernetes-pods
|
||||||
|
target_label: scrape_job
|
||||||
|
{{- end }}
|
||||||
|
{{- toYaml .Values.config.snippets.common | nindent 4 }}
|
||||||
|
{{- with .Values.config.snippets.extraRelabelConfigs }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
# -- Config file contents for Promtail.
|
||||||
|
# Must be configured as string.
|
||||||
|
# It is templated so it can be assembled from reusable snippets in order to avoid redundancy.
|
||||||
|
# @default -- See `values.yaml`
|
||||||
|
file: |
|
||||||
|
server:
|
||||||
|
log_level: {{ .Values.config.logLevel }}
|
||||||
|
http_listen_port: {{ .Values.config.serverPort }}
|
||||||
|
|
||||||
|
client:
|
||||||
|
url: {{ .Values.config.lokiAddress | default ( printf "http://%v.ix-%v.svc.cluster.local:3100/loki/api/v1/push" .Release.Name .Release.Name ) }}
|
||||||
|
{{- tpl .Values.config.snippets.extraClientConfigs . | nindent 2 }}
|
||||||
|
|
||||||
|
positions:
|
||||||
|
filename: /run/promtail/positions.yaml
|
||||||
|
|
||||||
|
scrape_configs:
|
||||||
|
{{- tpl .Values.config.snippets.scrapeConfigs . | nindent 2 }}
|
||||||
|
{{- tpl .Values.config.snippets.extraScrapeConfigs . | nindent 2 }}
|
||||||
Reference in New Issue
Block a user