iac/infrastructure/vector/base/statefulset.yaml

101 lines
3.6 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: vector-logs
spec:
serviceName: vector-logs-headless
replicas: 2
podManagementPolicy: Parallel
selector:
matchLabels: {app.kubernetes.io/name: vector-logs}
template:
metadata:
labels:
app.kubernetes.io/name: vector-logs
sidecar.istio.io/inject: "false"
annotations:
sidecar.istio.io/inject: "false"
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-init-first: "true"
vault.hashicorp.com/agent-pre-populate-only: "true"
vault.hashicorp.com/auth-path: auth/kubernetes
vault.hashicorp.com/role: vector-logs
vault.hashicorp.com/agent-run-as-user: "10001"
vault.hashicorp.com/agent-run-as-group: "10001"
vault.hashicorp.com/agent-inject-secret-aws-credentials: secrets/data/apps/vector/minio
vault.hashicorp.com/agent-inject-perms-aws-credentials: "0400"
vault.hashicorp.com/agent-inject-template-aws-credentials: |
{{- with secret "secrets/data/apps/vector/minio" -}}
[default]
aws_access_key_id = {{ index .Data.data "access_key" }}
aws_secret_access_key = {{ index .Data.data "secret_key" }}
{{- end -}}
spec:
serviceAccountName: vector-logs
imagePullSecrets:
- name: regcred
terminationGracePeriodSeconds: 90
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
fsGroup: 10001
seccompProfile: {type: RuntimeDefault}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels: {app.kubernetes.io/name: vector-logs}
containers:
- name: vector
image: timberio/vector:0.56.0-debian
args: ["--config", "/etc/vector/vector.yaml", "--require-healthy", "true"]
env:
- {name: VECTOR_LOG, value: info}
- {name: AWS_EC2_METADATA_DISABLED, value: "true"}
ports:
- {name: otlp, containerPort: 4317}
- {name: api, containerPort: 8686}
- {name: metrics, containerPort: 9598}
startupProbe:
httpGet: {path: /health, port: api}
failureThreshold: 60
periodSeconds: 10
readinessProbe:
httpGet: {path: /health, port: api}
livenessProbe:
httpGet: {path: /health, port: api}
periodSeconds: 20
resources:
requests: {cpu: 250m, memory: 512Mi, ephemeral-storage: 1Gi}
limits: {cpu: "2", memory: 2Gi, ephemeral-storage: 14Gi}
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities: {drop: [ALL]}
volumeMounts:
- {name: config, mountPath: /etc/vector, readOnly: true}
- {name: data, mountPath: /var/lib/vector}
- {name: tmp, mountPath: /tmp}
volumes:
- name: config
configMap: {name: vector-logs-config}
- name: data
# Node disk, scoped to this pod; removed when the pod is recreated.
# Keep headroom above Vector's 10Gi buffer for disk-buffer bookkeeping.
emptyDir: {sizeLimit: 12Gi}
- name: tmp
emptyDir: {sizeLimit: 128Mi}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: vector-logs
spec:
minAvailable: 1
selector:
matchLabels: {app.kubernetes.io/name: vector-logs}