Skip to content

Instantly share code, notes, and snippets.

View rverchere's full-sized avatar

Rémi Verchère rverchere

View GitHub Profile
@rverchere
rverchere / promtail_custom_values_1.yaml
Last active September 18, 2023 20:38
Promtail Custom Values 1
# Mount folder /var/log from node
extraVolumes:
- name: node-logs
hostPath:
path: /var/log
extraVolumeMounts:
- name: node-logs
mountPath: /var/log/host
readOnly: true
@rverchere
rverchere / promtail_custom_values_2.yaml
Last active June 29, 2022 21:13
Promtail Custom Values 2
# Set fsGroup to allow syslog file reading
podSecurityContext:
fsGroup: 4
@rverchere
rverchere / promtail_custom_values_3.yaml
Created June 29, 2022 21:16
Promtail Custom Values 3
# Scrape config to read syslog file from node
config:
snippets:
extraScrapeConfigs: |
# Add an additional scrape config for syslog
- job_name: node-syslog
static_configs:
- targets:
- localhost
labels:
@rverchere
rverchere / promtail_custom_values_4.yaml
Created June 29, 2022 21:18
Promtail Custom Values 4
# Allow environment variables usage
extraArgs:
- -config.expand-env=true
# Scrape config to read syslog file from node
config:
snippets:
extraScrapeConfigs: |
# Add an additional scrape config for syslog
- job_name: node-syslog
@rverchere
rverchere / kube-state-metrics-vpa.yaml
Last active February 9, 2025 11:11
kube-state-metrics configuration for VPA metrics
## Kube State Metrics to get VPA metrics
# Old vs New metrics:
# - kube_verticalpodautoscaler_labels -> kube_customresource_verticalpodautoscaler_labels
# - kube_verticalpodautoscaler_status_recommendation_containerrecommendations_target -> kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_target
# - kube_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound -> kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_lowerbound
# - kube_verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound -> kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_upperbound
# - kube_verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget -> kube_customresource_verticalpodautoscaler_status_recommendation_containerrecommendations_uncappedtarget
# Resources:
# - https://github.com/kubernetes/kube-state-metrics/blob/main/docs/customresourcestate-me
@rverchere
rverchere / migrate-cattle-agent-url.sh
Created February 25, 2025 10:52
Script to migrate downstream rancher cluster to a new rancher URL.
#!/usr/bin/env bash
set -eu
# This script change the rancher manager URL (same rancher server) for downstream clusters.
# You need to access to the downstream cluster outside of rancher manager server, as you need to stop the cattle-agent deployment.
RANCHER_URL=https://rancher.mycompany.com
context=$(kubectl config current-context | cut -d'@' -f 2) # My context name is user@cluster
mkdir -p $context
secretName=$(kubectl get deploy cattle-cluster-agent -n cattle-system -o jsonpath="{.spec.template.spec.volumes[0].secret.secretName}")