138 lines
3.6 KiB
YAML
138 lines
3.6 KiB
YAML
|
|
# Loki single-binary: one pod, one local-path PVC on siriussec.
|
||
|
|
#
|
||
|
|
# Off-node-ephemeral is satisfied by the PVC, not by the node's filesystem:
|
||
|
|
# the store lives in /opt/local-path-provisioner/... on the NVMe, survives
|
||
|
|
# pod restarts (and kubelet GC of /var/log/pods), and is re-mounted on node
|
||
|
|
# reboot. 8Gi is the bound; the measured need is well under 1 GiB (see
|
||
|
|
# docs/logging.md), so the PVC is ~10x the projected 8-day footprint.
|
||
|
|
apiVersion: v1
|
||
|
|
kind: PersistentVolumeClaim
|
||
|
|
metadata:
|
||
|
|
name: loki-data
|
||
|
|
namespace: logging
|
||
|
|
labels:
|
||
|
|
app.kubernetes.io/name: loki
|
||
|
|
app.kubernetes.io/part-of: logging
|
||
|
|
spec:
|
||
|
|
accessModes:
|
||
|
|
- ReadWriteOnce
|
||
|
|
storageClassName: local-path
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
storage: 8Gi
|
||
|
|
---
|
||
|
|
apiVersion: apps/v1
|
||
|
|
kind: Deployment
|
||
|
|
metadata:
|
||
|
|
name: loki
|
||
|
|
namespace: logging
|
||
|
|
labels:
|
||
|
|
app.kubernetes.io/name: loki
|
||
|
|
app.kubernetes.io/part-of: logging
|
||
|
|
spec:
|
||
|
|
replicas: 1
|
||
|
|
# RWO local-path volume: a rolling update would deadlock with the new pod
|
||
|
|
# Pending on the volume (same reason Grafana uses Recreate here).
|
||
|
|
strategy:
|
||
|
|
type: Recreate
|
||
|
|
selector:
|
||
|
|
matchLabels:
|
||
|
|
app.kubernetes.io/name: loki
|
||
|
|
template:
|
||
|
|
metadata:
|
||
|
|
labels:
|
||
|
|
app.kubernetes.io/name: loki
|
||
|
|
app.kubernetes.io/part-of: logging
|
||
|
|
spec:
|
||
|
|
# The PVC is provisioned by local-path on whichever node first mounts it;
|
||
|
|
# pin to the node with the NVMe and the free space.
|
||
|
|
nodeSelector:
|
||
|
|
kubernetes.io/hostname: siriussec
|
||
|
|
securityContext:
|
||
|
|
runAsNonRoot: true
|
||
|
|
runAsUser: 10001
|
||
|
|
runAsGroup: 10001
|
||
|
|
fsGroup: 10001
|
||
|
|
fsGroupChangePolicy: OnRootMismatch
|
||
|
|
seccompProfile:
|
||
|
|
type: RuntimeDefault
|
||
|
|
containers:
|
||
|
|
- name: loki
|
||
|
|
image: grafana/loki:3.7.1
|
||
|
|
imagePullPolicy: IfNotPresent
|
||
|
|
args:
|
||
|
|
- -config.file=/etc/loki/config.yaml
|
||
|
|
- -log.level=info
|
||
|
|
ports:
|
||
|
|
- name: http
|
||
|
|
containerPort: 3100
|
||
|
|
protocol: TCP
|
||
|
|
- name: grpc
|
||
|
|
containerPort: 9096
|
||
|
|
protocol: TCP
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
cpu: 50m
|
||
|
|
memory: 256Mi
|
||
|
|
limits:
|
||
|
|
cpu: "1"
|
||
|
|
memory: 1Gi
|
||
|
|
securityContext:
|
||
|
|
allowPrivilegeEscalation: false
|
||
|
|
readOnlyRootFilesystem: true
|
||
|
|
capabilities:
|
||
|
|
drop: ["ALL"]
|
||
|
|
readinessProbe:
|
||
|
|
httpGet:
|
||
|
|
path: /ready
|
||
|
|
port: http
|
||
|
|
initialDelaySeconds: 15
|
||
|
|
periodSeconds: 10
|
||
|
|
failureThreshold: 6
|
||
|
|
livenessProbe:
|
||
|
|
httpGet:
|
||
|
|
path: /ready
|
||
|
|
port: http
|
||
|
|
initialDelaySeconds: 60
|
||
|
|
periodSeconds: 30
|
||
|
|
failureThreshold: 4
|
||
|
|
volumeMounts:
|
||
|
|
- name: config
|
||
|
|
mountPath: /etc/loki
|
||
|
|
readOnly: true
|
||
|
|
- name: data
|
||
|
|
mountPath: /loki
|
||
|
|
- name: tmp
|
||
|
|
mountPath: /tmp
|
||
|
|
terminationGracePeriodSeconds: 60
|
||
|
|
volumes:
|
||
|
|
- name: config
|
||
|
|
configMap:
|
||
|
|
name: loki-config
|
||
|
|
- name: data
|
||
|
|
persistentVolumeClaim:
|
||
|
|
claimName: loki-data
|
||
|
|
- name: tmp
|
||
|
|
emptyDir: {}
|
||
|
|
---
|
||
|
|
apiVersion: v1
|
||
|
|
kind: Service
|
||
|
|
metadata:
|
||
|
|
name: loki
|
||
|
|
namespace: logging
|
||
|
|
labels:
|
||
|
|
app.kubernetes.io/name: loki
|
||
|
|
app.kubernetes.io/part-of: logging
|
||
|
|
spec:
|
||
|
|
type: ClusterIP
|
||
|
|
selector:
|
||
|
|
app.kubernetes.io/name: loki
|
||
|
|
ports:
|
||
|
|
- name: http
|
||
|
|
port: 3100
|
||
|
|
targetPort: http
|
||
|
|
protocol: TCP
|
||
|
|
- name: grpc
|
||
|
|
port: 9096
|
||
|
|
targetPort: grpc
|
||
|
|
protocol: TCP
|