- Überblick
- Anforderungen
- Bereitstellungsvorlagen
- Anleitung: Vorbereiten der Installation
- Anleitung: Vorbereiten der Installation
- Schritt 2: Konfigurieren der OCI-konformen Registrierung für Offline-Installationen
- Schritt 3: Konfigurieren des externen Objektspeichers
- Schritt 4: Konfigurieren des High Availability Add-on
- Schritt 5: Konfigurieren von SQL-Datenbanken
- Schritt 7: Konfigurieren des DNS
- Schritt 8: Konfigurieren der Datenträger
- Schritt 9: Konfigurieren der Einstellungen auf Kernel- und Betriebssystemebene
- Schritt 10: Konfigurieren der Knotenports
- Schritt 11: Anwenden verschiedener Einstellungen
- Schritt 12: Validieren und Installieren der erforderlichen RPM-Pakete
- Schritt 13: Generieren von cluster_config.json
- Cluster_config.json-Beispiel
- Allgemeine Konfiguration
- Profilkonfiguration
- Zertifikatkonfiguration
- Datenbankkonfiguration
- Konfiguration des externen Objektspeichers
- Vorsignierte URL-Konfiguration
- ArgoCD-Konfiguration
- Konfiguration der Kerberos-Authentifizierung
- Externe OCI-konforme Registrierungskonfiguration
- Disaster Recovery: Aktiv/Passiv- und Aktiv/Aktiv-Konfigurationen
- Konfiguration des High Availability Add-ons
- Spezifische Orchestrator-Konfiguration
- Insights-spezifische Konfiguration
- Process Mining-spezifische Konfiguration
- Spezifische Konfiguration für Document Understanding
- Spezifische Konfiguration für Automation Suite Robots
- Konfiguration der Überwachung
- Optional: Konfigurieren des Proxyservers
- Optional: Aktivieren der Widerstandsfähigkeit gegen zonale Ausfälle in einem HA-fähigen Produktionscluster mit mehreren Knoten
- Optional: Übergeben einer benutzerdefinierten resolv.conf-Datei
- Optional: Erhöhen der Fehlertoleranz
- Hinzufügen eines dedizierten Agent-Knotens mit GPU-Unterstützung
- Hinzufügen eines dedizierten Agentenknotens für Automation Suite-Roboter
- Schritt 15: Konfigurieren der temporären Docker-Registrierung für Offline-Installationen
- Schritt 16: Validieren der Voraussetzungen für die Installation
- Ausführen von uipathctl
- Manuell: Durchführen der Installation
- Nach der Installation
- Clusterverwaltung
- Verwalten von Produkten
- Erste Schritte mit dem Clusterverwaltungsportal
- Migrieren von Redis vom clusterinternen zum externen High Availability Add-on
- Clusterinterner Objectstore zu einem externen Objectstore migrieren
- Migrieren von der clusterinternen Registrierung zu einer externen OCI-konformen Registrierung
- Manueller Wechsel zum sekundären Cluster in einem Aktiv-/Passiv-Setup
- Disaster Recovery: Durchführen von Vorgängen nach der Installation
- Umwandlung einer bestehenden Installation in eine Multi-Site-Einrichtung
- Richtlinien zum Upgrade einer Aktiv/Passiv- oder Aktiv/Aktiv-Bereitstellung
- Leitlinien zum Sichern und Wiederherstellen einer Aktiv-/Passiv- oder Aktiv/Aktiv-Bereitstellung
- Skalieren einer Bereitstellung mit einem einzelnen Knoten (Auswertung) zu einer Bereitstellung mit mehreren Knoten (HA).
- Überwachung und Warnungen
- Migration und Upgrade
- Migrieren zwischen Automation Suite-Clustern
- Aktualisieren der Automation Suite
- Herunterladen der Installationspakete und Übertragen aller Dateien auf den ersten Serverknoten
- Abrufen der zuletzt angewendeten Konfiguration aus dem Cluster
- Aktualisieren der Clusterkonfiguration
- Konfigurieren der OCI-konformen Registrierung für Offline-Installationen
- Ausführen des Upgrades
- Durchführen von Vorgängen nach dem Upgrade
- Produktspezifische Konfiguration
- Erweiterte Orchestrator-Konfiguration
- Konfigurieren von Orchestrator-Parametern
- Konfigurieren von AppSettings
- Konfigurieren der maximalen Anforderungsgröße
- Überschreiben der Speicherkonfiguration auf Clusterebene
- Konfigurieren von NLog
- Speichern von Roboterprotokollen in Elasticsearch
- Konfigurieren von Anmeldeinformationsspeichern
- Konfigurieren der Verwendung von einem Verschlüsselungsschlüssel pro Mandant
- Bereinigen der Orchestrator-Datenbank
- Installation der Hostbibliothek überspringen
- Best Practices und Wartung
- Fehlersuche und ‑behebung
- Fehlerbehebung bei Diensten während der Installation
- So reduzieren Sie Berechtigungen für ein NFS-Sicherungsverzeichnis
- Deinstallieren des Clusters
- Löschen von Offline-Artefakten für mehr Speicherplatz
- So löschen Sie Redis-Daten
- So können Sie die Istio-Protokollierung aktivieren
- So werden Protokolle manuell bereinigt
- Verschieben von Ceph aus dem schreibgeschützten Modus
- So löschen Sie alte Protokolle, die im sf-logs-Bucket gespeichert sind
- So deaktivieren Sie Streaming-Protokolle für das AI Center
- Fehlerbehebung bei fehlgeschlagenen Automation Suite-Installationen
- So löschen Sie Bilder aus dem alten Installationsprogramm nach dem Upgrade
- Deaktivieren von TX-Prüfsummen-Offloading
- So legen Sie die ArgoCD-Protokollebene manuell auf Info fest
- So erweitern Sie den AI Center-Speicher
- So wird der codierte pull_secret_value für externe Registrierungen generiert
- Umgang mit schwachen Verschlüsselungen in TLS 1.2
- So überprüfen Sie die TLS-Version
- So arbeiten Sie mit Zertifikaten
- So planen Sie die Ceph-Sicherung und Wiederherstellung von Daten
- Sammeln von DU-Nutzungsdaten mit dem clusterinternen Objektspeicher (Ceph)
- So installieren Sie RKE2 SELinux in Air-Gap-Umgebungen
- So löschen Sie alte differenzielle Sicherungen auf einem NFS-Server
- So stellen Sie Insights in einem FIPS-fähigen Cluster bereit
- So migrieren Sie zu cgroup v2
- So stellen Sie die Kerberos-Authentifizierung nach einem VM-Neustart wieder her
- So pushen Sie ein lokales Docker-Image in die Registrierung innerhalb des Clusters
- So schließen Sie Buckets von der Sicherung aus
- Fehler beim Herunterladen des Pakets
- Die Offlineinstallation schlägt aufgrund fehlender binärer Dateien fehl
- Azure-Datenträger nicht als SSD markiert
- Fehler nach der Zertifikatsaktualisierung
- Validierungsfehler beim TLS-Zertifikat
- Antivirus causes installation and operation issues
- Automation Suite funktioniert nach Betriebssystem-Upgrade nicht
- Bei der Automation Suite muss „backlog_wait_time“ auf 0 gesetzt werden.
- Die temporäre Registrierungsinstallation schlägt unter RHEL 8.9 fehl
- Häufiges Neustartproblem bei UiPath-Namespace-Bereitstellungen während Offline-Installationen
- DNS-Einstellungen werden von CoreDNS nicht berücksichtigt
- Das Seeding der Registrierung innerhalb des Clusters schlägt aufgrund von unzureichendem Speicher fehl
- Voraussetzungsprüfungen schlagen fehl, wenn moderne Document Understanding-Projekte aktiviert und AI Center deaktiviert ist
- Pods hängen im Init-Status aufgrund eines Fehlers bei der Bereitstellung des XFS-Volumes fest
- Clusterdaten scheinen nach einem Neustart aufgrund einer falschen Bereitstellungsreihenfolge von Rancher und etcd verloren zu gehen
- Upgrade schlägt aufgrund eines fehlerhaften Ceph . fehl
- Upgrade schlägt aufgrund von klassischen Objekten in der Orchestrator-Datenbank fehl
- Ceph-Cluster in beeinträchtigtem Status nach parallelem Upgrade
- Dienst-Upgrade schlägt für Apps fehl
- Timeouts beim direkten Upgrade
- Upgrade schlägt in Offline-Umgebungen fehl
- Snapshot-controller-crds Pod im Status CrashLoopBackOff nach dem Upgrade
- Upgrade schlägt aufgrund überschriebener Insights-PVC-Größen fehl
- Upgradefehler aufgrund von Hostnamen in Großbuchstaben
- Fehler beim Hoch- oder Herunterladen von Daten im Objektspeicher
- Fehler beim Anhängen eines StatefulSet-Volumes
- Fehler beim Komprimieren von Metriken aufgrund beschädigter Blöcke in Thenos
- Festlegen eines Timeout-Intervalls für die Verwaltungsportale
- Die Authentifizierung funktioniert nach der Migration nicht
- kinit: KDC kann für Realm <AD Domain> beim Abrufen der ersten Anmeldeinformationen nicht gefunden werden
- Kinit: Keytab enthält keine geeigneten Schlüssel für *** beim Abrufen der ersten Anmeldeinformationen
- GSSAPI-Vorgang aufgrund eines ungültigen Statuscodes fehlgeschlagen
- Alarm für fehlgeschlagenen Kerberos-tgt-update-Auftrag erhalten
- SSPI-Anbieter: Server in Kerberos-Datenbank nicht gefunden
- Anmeldung eines AD-Benutzers aufgrund eines deaktivierten Kontos fehlgeschlagen
- ArgoCD-Anmeldung fehlgeschlagen
- Fehler beim Abrufen des Sandbox-Abbilds
- Pods werden nicht in der ArgoCD-Benutzeroberfläche angezeigt
- Redis-Testfehler
- RKE2-Server kann nicht gestartet werden
- ArgoCD wechselt nach der ersten Installation in den Status „In Bearbeitung“.
- ArgoCD-Repository-Server-Pod in „CrashLoopBackOff“.
- Manuelle Schadensbegrenzung bei ArgoCD NetworkPolicy (GHSA-47m3-95c7-g2g8)
- Fehlende Ceph-rook-Metriken in Überwachungs-Dashboards
- Diskrepanz bei gemeldeten Fehlern bei diagnostischen Zustandsprüfungen
- Konfigurieren von Ressourcenanforderungen und Limits für von uipathctl erstellte Workloads
- Kein normales Upstream-Problem
- Redis-Start wird durch Antivirenprogramm blockiert
- AI Center und Document Understanding Pods können bei aktivierter TLS-Zertifikatsverifizierung nicht gestartet werden
- Fluentd exportiert keine Protokolle in IPv6-Umgebungen
- Studio Desktop kann keine Integration Service-Connectors und -Aktivitäten laden
- Document Understanding erscheint nicht auf der linken Leiste der Automation Suite
- Fehlerstatus beim Erstellen einer Datenbeschriftungssitzung
- Fehlerstatus beim Versuch, eine ML-Fähigkeit bereitzustellen
- Migrationsauftrag schlägt in ArgoCD fehl
- Die Handschrifterkennung mit dem Intelligent Form Extractor funktioniert nicht oder arbeitet zu langsam
- Ausführen von Hochverfügbarkeit mit Process Mining
- Die Process Mining-Datenaufnahme ist bei der Anmeldung über Kerberos fehlgeschlagen
- Verbindung mit der Datenbank „AutomationSuite_ProcessMining_Lager“ über eine Verbindungszeichenfolge im pyodbc-Format nicht möglich
- Die Airflow-Installation schlägt mit „sqlaldemy.exc.ArgumentError“ fehl: URL konnte nicht analysiert werden rfc1738 aus Zeichenfolge „
- So fügen Sie eine IP-Tabellenregel hinzu, um den SQL Server-Port 1433 zu verwenden
- Dem Automation Suite-Zertifikat des Servers, auf dem CData Sync ausgeführt wird, wird nicht vertraut
- Process Mining kann nach dem Deaktivieren und erneuten Aktivieren nicht geladen werden
- Ausführen des Diagnosetools
- Verwenden des Automation Suite-Supportpakets
- Erkunden von Protokollen
Fehler beim Komprimieren von Metriken aufgrund beschädigter Blöcke in Thenos
Reparieren Sie beschädigte Metrikblöcke im Thenos- Kompaktor für die Automation Suite-Überwachung unter Linux.
Beschreibung
Der Thenos-Kompaktor kann Metriken möglicherweise nicht komprimiert werden, wenn beschädigte Blöcke im Objektspeicher erkannt werden. Diese Bedingung verhindert, dass der Kompaktor Metriken verarbeitet, was zu einem erhöhten Speicherverbrauch im Ceph-Bucket führt.
Lösung
Führen Sie die folgenden Schritte aus, um das Problem zu beheben:
-
Führen Sie auf einem beliebigen Serverknoten das folgende Skript aus:
thanosns=monitoring && if kubectl get application -n argocd rancher-monitoring; then thanosns=cattle-monitoring-system; fi && cat <<EOF | kubectl apply -f - --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: annotations: labels: app.kubernetes.io/component: thanos-cleaner app.kubernetes.io/instance: thanos-block-cleaner app.kubernetes.io/name: thanos-block-cleaner name: thanos-cleaner-role namespace: ${thanosns} rules: - apiGroups: - apps resources: - statefulsets - statefulsets/scale verbs: - list - get - update - patch - apiGroups: - batch resources: - jobs - cronjobs verbs: - delete - list - get - update - create - watch - apiGroups: - "" resources: - pods verbs: - delete - list - get - update --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: labels: app.kubernetes.io/component: thanos-cleaner app.kubernetes.io/instance: thanos-block-cleaner app.kubernetes.io/name: thanos-block-cleaner name: thanos-cleaner-role-binding namespace: ${thanosns} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: thanos-cleaner-role subjects: - kind: ServiceAccount name: thanos-cleaner namespace: ${thanosns} --- apiVersion: v1 kind: ServiceAccount metadata: name: thanos-cleaner namespace: ${thanosns} --- apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: name: thanos-cleaner namespace: uipath spec: groups: - name: thanos rules: - alert: ThanosCompactorNotWorking annotations: description: Thanos compactor is not working. This will disable metrics compaction in objectstore bucket. Please check thanos compact pod in ${thanosns} namespace for any error. Compactor in faulty state will exhaust object store space message: Thanos compactor is not working. Please check if thanos cleaner job is functional and able to fix corruption runbook_url: https://docs.uipath.com/automation-suite/docs/alert-runbooks summary: Thanos compactor is not working expr: thanos_compactor_issue{job="thanos-cleaner"} >= 1 for: 1d labels: app: thanos severity: critical --- EOFthanosns=monitoring && if kubectl get application -n argocd rancher-monitoring; then thanosns=cattle-monitoring-system; fi && cat <<EOF | kubectl apply -f - --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: annotations: labels: app.kubernetes.io/component: thanos-cleaner app.kubernetes.io/instance: thanos-block-cleaner app.kubernetes.io/name: thanos-block-cleaner name: thanos-cleaner-role namespace: ${thanosns} rules: - apiGroups: - apps resources: - statefulsets - statefulsets/scale verbs: - list - get - update - patch - apiGroups: - batch resources: - jobs - cronjobs verbs: - delete - list - get - update - create - watch - apiGroups: - "" resources: - pods verbs: - delete - list - get - update --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: labels: app.kubernetes.io/component: thanos-cleaner app.kubernetes.io/instance: thanos-block-cleaner app.kubernetes.io/name: thanos-block-cleaner name: thanos-cleaner-role-binding namespace: ${thanosns} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: thanos-cleaner-role subjects: - kind: ServiceAccount name: thanos-cleaner namespace: ${thanosns} --- apiVersion: v1 kind: ServiceAccount metadata: name: thanos-cleaner namespace: ${thanosns} --- apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: name: thanos-cleaner namespace: uipath spec: groups: - name: thanos rules: - alert: ThanosCompactorNotWorking annotations: description: Thanos compactor is not working. This will disable metrics compaction in objectstore bucket. Please check thanos compact pod in ${thanosns} namespace for any error. Compactor in faulty state will exhaust object store space message: Thanos compactor is not working. Please check if thanos cleaner job is functional and able to fix corruption runbook_url: https://docs.uipath.com/de/automation-suite/docs/alert-runbooks summary: Thanos compactor is not working expr: thanos_compactor_issue{job="thanos-cleaner"} >= 1 for: 1d labels: app: thanos severity: critical --- EOF -
Führen Sie auf einem beliebigen Serverknoten das folgende Skript aus:
cat <<'EOF' | kubectl apply -f - --- apiVersion: v1 data: thanos-cleanup.sh: | #!/bin/bash # Copyright UiPath 2021 # # ================= # LICENSE AGREEMENT # ----------------- # Use of paid UiPath products and services is subject to the licensing agreement # executed between you and UiPath. Unless otherwise indicated by UiPath, use of free # UiPath products is subject to the associated licensing agreement available here: # https://www.uipath.com/legal/trust-and-security/legal-terms (or successor website). # You must not use this file separately from the product it is a part of or is associated with. set -eu -o pipefail export PATH=$PATH:/thanos-bin/ # Below script removes the blocks which are overlapping or having index issue or having duplicated compaction # # In few cases with above mentioned scenarios, thanos may skip the compaction and halt the compaction module. # Compaction halt requires manual deletion of corrupted blocks and restart of compact pod. config_file=/etc/thanos/${THANOS_CONFIG_KEY} function info() { echo "[INFO] [$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" } function warn() { echo -e "\e[0;33m[WARN] [$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 } function error_without_exit() { echo -e "\e[0;31m[ERROR][$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 } function error() { echo -e "\e[0;31m[ERROR][$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 exit 1 } function is_compaction_halted() { info "Checking if thanos compactor running" IFS=" " read -r -a compactor_addresses <<<"$(kubectl get pods -n "$NAMESPACE" -l app.kubernetes.io/instance=thanos-compact -o jsonpath="{.items[*].status.podIP}")" is_compactor_halted=0 if [[ "${#compactor_addresses[@]}" -eq 0 ]]; then info "Thanos compactor pod is not running" is_compactor_halted=1 fi for ip in "${compactor_addresses[@]}"; do #shellcheck disable=SC2086 halted=$(curl -s http://${ip}:10902/metrics | grep thanos_compact_halted | grep -v '#' | awk -F ' ' '{print $2}') if [[ "$halted" -eq "1" ]]; then warn "Compaction is halted" is_compactor_halted=1 break fi done return $is_compactor_halted } function execute_thanos_issue_command() { if [[ $# -ne 1 ]]; then error "missing issue name for execute_thanos_issue_command function" fi issue=$1 info "Checking for issue $issue" cmd_ret=0 #shellcheck disable=SC2086 verify_output=$(thanos tools bucket --objstore.config-file=${config_file} verify --log.format=json -i $issue 2>&1) && true || cmd_ret=1 if [[ $cmd_ret -eq 1 ]]; then error_without_exit "Output of $issue command: -> $verify_output" error "Failed to verify bucket for $issue" fi #shellcheck disable=SC2086 echo $verify_output } function fix_index_issue() { info "Fixing index_known_issue issue" verify_output=$(execute_thanos_issue_command "index_known_issues") #shellcheck disable=SC2086 for b in $(echo $verify_output | sed 's/} {/\r\n/g' | grep err | grep "detected issue" | awk -F '"id":' '{print $2}' | awk -F ',' '{print $1}' | tr -d '"'); do info "Block=$b is having the issue, removing it.." thanos tools bucket mark --id="$b" \ --marker=deletion-mark.json \ --details="deleted by job" \ --objstore.config-file="${config_file}" info "Block=$b is marked for deletion" done info "Fixing index_known_issue issue done" } function fix_overlapping_issue() { info "Fixing overlapped_blocks issue" overlap_output=$(execute_thanos_issue_command "overlapped_blocks") while IFS= read -r line; do #shellcheck disable=SC2086 for b in $(echo $line | awk -F '"overlap":' '{print $2}' | awk -v search="ulid" 'match($0, search) {print substr($0, RSTART)}' | sed 's/ulid/\r\nulid/g' | awk -F ',' '{print $1}' | grep '^ulid' | awk -F ': ' '{print $2}'); do info "Block=$b is having the issue, removing it.." thanos tools bucket mark --id="$b" \ --marker=deletion-mark.json \ --details="deleted by job" \ --objstore.config-file="${config_file}" info "Block=$b is marked for deletion" done done < <(echo "$overlap_output" | sed 's/} {/\r\n/g' | grep "found overlapped blocks") info "Fixing overlapped_blocks issue done" } function fix_duplicate_issue() { info "Fixing duplicated_compaction issue" duplicate_output=$(execute_thanos_issue_command "duplicated_compaction") #shellcheck disable=SC2086,SC2006 for b in $(echo $duplicate_output | sed 's/ts=2/\r\n2/g' | grep "Found duplicated blocks that are ok to be removed" | awk -F 'ULIDs="' '{print $2}' | tr -d '[]' | awk -F '"' '{print $1}'); do info "Block=$b is having the issue, removing it.." thanos tools bucket mark --id="$b" \ --marker=deletion-mark.json \ --details="deleted by job" \ --objstore.config-file="${config_file}" info "Block=$b is marked for deletion" done info "Fixing duplicated_compaction issue done" } if [[ -z "$NAMESPACE" ]]; then error "NAMESPACE is not set" fi # We will check if compaction is halted or not before checking for issues if is_compaction_halted; then info "Thanos compaction is working" echo "thanos_compactor_issue 0" | curl --data-binary @- "http://pushgateway-prometheus-pushgateway.uipath.svc.cluster.local:9091/metrics/job/thanos-cleaner" exit 0 fi warn "Thanos compactor is not working. Checking for corrupted blocks..." echo "thanos_compactor_issue 1" | curl --data-binary @- "http://pushgateway-prometheus-pushgateway.uipath.svc.cluster.local:9091/metrics/job/thanos-cleaner" if [[ "$DISABLE_BLOCK_CLEANER" == true ]]; then info "DISABLE_BLOCK_CLEANER is set to $DISABLE_BLOCK_CLEANER, skipping block clean" exit 0 fi info "DISABLE_BLOCK_CLEANER is set to $DISABLE_BLOCK_CLEANER, removing corrupted blocks" replica=$(kubectl get sts -n "$NAMESPACE" thanos-compact -o jsonpath='{.spec.replicas}') # compactor must not be running while deleting blocks info "Stopping compactor" kubectl scale sts -n "$NAMESPACE" thanos-compact --replicas=0 kubectl delete pods -n "$NAMESPACE" -l app.kubernetes.io/instance=thanos-compact --force # fixing index_known_issues info "Checking blocks having issue" fix_index_issue fix_overlapping_issue fix_duplicate_issue info "Triggering deletion of all marked blocks" #shellcheck disable=SC2086 thanos tools bucket cleanup --delete-delay=0 --objstore.config-file=${config_file} info "Corrupted blocks are deleted" info "Scaling thanos compactor's replica to $replica" #shellcheck disable=SC2086 kubectl scale sts -n "$NAMESPACE" thanos-compact --replicas=$replica info "Thanos compactor started" validate-cronjob.sh: | #!/bin/bash # Copyright UiPath 2021 # # ================= # LICENSE AGREEMENT # ----------------- # Use of paid UiPath products and services is subject to the licensing agreement # executed between you and UiPath. Unless otherwise indicated by UiPath, use of free # UiPath products is subject to the associated licensing agreement available here: # https://www.uipath.com/legal/trust-and-security/legal-terms (or successor website). # You must not use this file separately from the product it is a part of or is associated with. set -eu -o pipefail function info() { echo "[INFO] [$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" } function warn() { echo -e "\e[0;33m[WARN] [$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 } function error_without_exit() { echo -e "\e[0;31m[ERROR][$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 } function error() { echo -e "\e[0;31m[ERROR][$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 exit 1 } alias kubectl='kubectl --cache-dir=/tmp/' IFS="," read -ra cronjobs <<<"$CRONJOB_LIST" for cr in "${cronjobs[@]}"; do #shellcheck disable=SC2206 name=(${cr//// }) cronNs=default cronName="" if [[ ${#name[@]} -gt 2 || ${#name[@]} -lt 1 ]]; then error "Invalid cronjob name=$cr" fi if [[ ${#name[@]} -eq 2 ]]; then cronNs=${name[0]} cronName=${name[1]} else cronName=${name[0]} fi info "Validating cronjob=$cr" jobName="${cronName}-sf-job-validation" created=1 info "Creating validation job for $cr" kubectl delete job -n "${cronNs}" "${jobName}" --ignore-not-found --timeout=3m #shellcheck disable=SC2086 kubectl create job -n "${cronNs}" --from=cronjob/${cronName} "$jobName" || created=0 if [[ $created == 0 ]]; then error "Failed to create job for $cr" fi #shellcheck disable=SC2086 kubectl wait --timeout=20m --for=condition=complete -n "${cronNs}" job/$jobName & cpid=$! #shellcheck disable=SC2086 kubectl wait --timeout=20m --for=condition=failed -n "${cronNs}" job/${jobName} && exit 1 & fpid=$! ret=0 wait -n $cpid $fpid || ret=1 kill -9 $cpid || true kill -9 $fpid || true if [[ $ret -eq 0 ]]; then info "Job for $cr is validated/completed" #ignore deletion error. if deletion fail then will get caught in next sync. This is to reduce failure during installation kubectl delete job -n "${cronNs}" "${jobName}" --timeout=3m || true else error "Job for $cr failed" fi done kind: ConfigMap metadata: name: thanos-cleaner-script namespace: monitoring --- EOFcat <<'EOF' | kubectl apply -f - --- apiVersion: v1 data: thanos-cleanup.sh: | #!/bin/bash # Copyright UiPath 2021 # # ================= # LICENSE AGREEMENT # ----------------- # Use of paid UiPath products and services is subject to the licensing agreement # executed between you and UiPath. Unless otherwise indicated by UiPath, use of free # UiPath products is subject to the associated licensing agreement available here: # https://www.uipath.com/legal/trust-and-security/legal-terms (or successor website). # You must not use this file separately from the product it is a part of or is associated with. set -eu -o pipefail export PATH=$PATH:/thanos-bin/ # Below script removes the blocks which are overlapping or having index issue or having duplicated compaction # # In few cases with above mentioned scenarios, thanos may skip the compaction and halt the compaction module. # Compaction halt requires manual deletion of corrupted blocks and restart of compact pod. config_file=/etc/thanos/${THANOS_CONFIG_KEY} function info() { echo "[INFO] [$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" } function warn() { echo -e "\e[0;33m[WARN] [$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 } function error_without_exit() { echo -e "\e[0;31m[ERROR][$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 } function error() { echo -e "\e[0;31m[ERROR][$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 exit 1 } function is_compaction_halted() { info "Checking if thanos compactor running" IFS=" " read -r -a compactor_addresses <<<"$(kubectl get pods -n "$NAMESPACE" -l app.kubernetes.io/instance=thanos-compact -o jsonpath="{.items[*].status.podIP}")" is_compactor_halted=0 if [[ "${#compactor_addresses[@]}" -eq 0 ]]; then info "Thanos compactor pod is not running" is_compactor_halted=1 fi for ip in "${compactor_addresses[@]}"; do #shellcheck disable=SC2086 halted=$(curl -s http://${ip}:10902/metrics | grep thanos_compact_halted | grep -v '#' | awk -F ' ' '{print $2}') if [[ "$halted" -eq "1" ]]; then warn "Compaction is halted" is_compactor_halted=1 break fi done return $is_compactor_halted } function execute_thanos_issue_command() { if [[ $# -ne 1 ]]; then error "missing issue name for execute_thanos_issue_command function" fi issue=$1 info "Checking for issue $issue" cmd_ret=0 #shellcheck disable=SC2086 verify_output=$(thanos tools bucket --objstore.config-file=${config_file} verify --log.format=json -i $issue 2>&1) && true || cmd_ret=1 if [[ $cmd_ret -eq 1 ]]; then error_without_exit "Output of $issue command: -> $verify_output" error "Failed to verify bucket for $issue" fi #shellcheck disable=SC2086 echo $verify_output } function fix_index_issue() { info "Fixing index_known_issue issue" verify_output=$(execute_thanos_issue_command "index_known_issues") #shellcheck disable=SC2086 for b in $(echo $verify_output | sed 's/} {/\r\n/g' | grep err | grep "detected issue" | awk -F '"id":' '{print $2}' | awk -F ',' '{print $1}' | tr -d '"'); do info "Block=$b is having the issue, removing it.." thanos tools bucket mark --id="$b" \ --marker=deletion-mark.json \ --details="deleted by job" \ --objstore.config-file="${config_file}" info "Block=$b is marked for deletion" done info "Fixing index_known_issue issue done" } function fix_overlapping_issue() { info "Fixing overlapped_blocks issue" overlap_output=$(execute_thanos_issue_command "overlapped_blocks") while IFS= read -r line; do #shellcheck disable=SC2086 for b in $(echo $line | awk -F '"overlap":' '{print $2}' | awk -v search="ulid" 'match($0, search) {print substr($0, RSTART)}' | sed 's/ulid/\r\nulid/g' | awk -F ',' '{print $1}' | grep '^ulid' | awk -F ': ' '{print $2}'); do info "Block=$b is having the issue, removing it.." thanos tools bucket mark --id="$b" \ --marker=deletion-mark.json \ --details="deleted by job" \ --objstore.config-file="${config_file}" info "Block=$b is marked for deletion" done done < <(echo "$overlap_output" | sed 's/} {/\r\n/g' | grep "found overlapped blocks") info "Fixing overlapped_blocks issue done" } function fix_duplicate_issue() { info "Fixing duplicated_compaction issue" duplicate_output=$(execute_thanos_issue_command "duplicated_compaction") #shellcheck disable=SC2086,SC2006 for b in $(echo $duplicate_output | sed 's/ts=2/\r\n2/g' | grep "Found duplicated blocks that are ok to be removed" | awk -F 'ULIDs="' '{print $2}' | tr -d '[]' | awk -F '"' '{print $1}'); do info "Block=$b is having the issue, removing it.." thanos tools bucket mark --id="$b" \ --marker=deletion-mark.json \ --details="deleted by job" \ --objstore.config-file="${config_file}" info "Block=$b is marked for deletion" done info "Fixing duplicated_compaction issue done" } if [[ -z "$NAMESPACE" ]]; then error "NAMESPACE is not set" fi # We will check if compaction is halted or not before checking for issues if is_compaction_halted; then info "Thanos compaction is working" echo "thanos_compactor_issue 0" | curl --data-binary @- "http://pushgateway-prometheus-pushgateway.uipath.svc.cluster.local:9091/metrics/job/thanos-cleaner" exit 0 fi warn "Thanos compactor is not working. Checking for corrupted blocks..." echo "thanos_compactor_issue 1" | curl --data-binary @- "http://pushgateway-prometheus-pushgateway.uipath.svc.cluster.local:9091/metrics/job/thanos-cleaner" if [[ "$DISABLE_BLOCK_CLEANER" == true ]]; then info "DISABLE_BLOCK_CLEANER is set to $DISABLE_BLOCK_CLEANER, skipping block clean" exit 0 fi info "DISABLE_BLOCK_CLEANER is set to $DISABLE_BLOCK_CLEANER, removing corrupted blocks" replica=$(kubectl get sts -n "$NAMESPACE" thanos-compact -o jsonpath='{.spec.replicas}') # compactor must not be running while deleting blocks info "Stopping compactor" kubectl scale sts -n "$NAMESPACE" thanos-compact --replicas=0 kubectl delete pods -n "$NAMESPACE" -l app.kubernetes.io/instance=thanos-compact --force # fixing index_known_issues info "Checking blocks having issue" fix_index_issue fix_overlapping_issue fix_duplicate_issue info "Triggering deletion of all marked blocks" #shellcheck disable=SC2086 thanos tools bucket cleanup --delete-delay=0 --objstore.config-file=${config_file} info "Corrupted blocks are deleted" info "Scaling thanos compactor's replica to $replica" #shellcheck disable=SC2086 kubectl scale sts -n "$NAMESPACE" thanos-compact --replicas=$replica info "Thanos compactor started" validate-cronjob.sh: | #!/bin/bash # Copyright UiPath 2021 # # ================= # LICENSE AGREEMENT # ----------------- # Use of paid UiPath products and services is subject to the licensing agreement # executed between you and UiPath. Unless otherwise indicated by UiPath, use of free # UiPath products is subject to the associated licensing agreement available here: # https://www.uipath.com/legal/trust-and-security/legal-terms (or successor website). # You must not use this file separately from the product it is a part of or is associated with. set -eu -o pipefail function info() { echo "[INFO] [$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" } function warn() { echo -e "\e[0;33m[WARN] [$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 } function error_without_exit() { echo -e "\e[0;31m[ERROR][$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 } function error() { echo -e "\e[0;31m[ERROR][$(date +'%Y-%m-%dT%H:%M:%S%z')]:\e[0m $*" >&2 exit 1 } alias kubectl='kubectl --cache-dir=/tmp/' IFS="," read -ra cronjobs <<<"$CRONJOB_LIST" for cr in "${cronjobs[@]}"; do #shellcheck disable=SC2206 name=(${cr//// }) cronNs=default cronName="" if [[ ${#name[@]} -gt 2 || ${#name[@]} -lt 1 ]]; then error "Invalid cronjob name=$cr" fi if [[ ${#name[@]} -eq 2 ]]; then cronNs=${name[0]} cronName=${name[1]} else cronName=${name[0]} fi info "Validating cronjob=$cr" jobName="${cronName}-sf-job-validation" created=1 info "Creating validation job for $cr" kubectl delete job -n "${cronNs}" "${jobName}" --ignore-not-found --timeout=3m #shellcheck disable=SC2086 kubectl create job -n "${cronNs}" --from=cronjob/${cronName} "$jobName" || created=0 if [[ $created == 0 ]]; then error "Failed to create job for $cr" fi #shellcheck disable=SC2086 kubectl wait --timeout=20m --for=condition=complete -n "${cronNs}" job/$jobName & cpid=$! #shellcheck disable=SC2086 kubectl wait --timeout=20m --for=condition=failed -n "${cronNs}" job/${jobName} && exit 1 & fpid=$! ret=0 wait -n $cpid $fpid || ret=1 kill -9 $cpid || true kill -9 $fpid || true if [[ $ret -eq 0 ]]; then info "Job for $cr is validated/completed" #ignore deletion error. if deletion fail then will get caught in next sync. This is to reduce failure during installation kubectl delete job -n "${cronNs}" "${jobName}" --timeout=3m || true else error "Job for $cr failed" fi done kind: ConfigMap metadata: name: thanos-cleaner-script namespace: monitoring --- EOF -
Ersetzen Sie
SF_K8S_TAGdurch das richtige Image-Tag und wenden Sie dann den Cronjob an.Rufen Sie aus dem Installationsverzeichnis auf einem beliebigen Serverknoten das aktuellste Tag ab:
cat versions/docker-images.json |grep uipath/sf-k8-utils-rhel | tr -d ',"' | awk -F ':' '{print $2}' |sort |uniq |tail -1cat versions/docker-images.json |grep uipath/sf-k8-utils-rhel | tr -d ',"' | awk -F ':' '{print $2}' |sort |uniq |tail -1Aktualisieren Sie dann den Cronjob-Block, indem Sie
SF_K8S_TAGdurch den zurückgegebenen Wert ersetzen.Fügen Sie nach der Aktualisierung den gesamten Block in das Terminal eines beliebigen Serverknotens ein:
thanosns=monitoring && if kubectl get application -n argocd rancher-monitoring; then thanosns=cattle-monitoring-system; fi && thanosimage=$(kubectl get statefulset -n $thanosns thanos-compact -o jsonpath='{.spec.template.spec.containers[0].image}') && cat <<EOF | kubectl apply -f - --- apiVersion: batch/v1 kind: CronJob metadata: name: thanos-cleaner namespace: ${thanosns} spec: concurrencyPolicy: Forbid failedJobsHistoryLimit: 3 jobTemplate: metadata: creationTimestamp: null spec: backoffLimit: 3 template: metadata: annotations: sidecar.istio.io/inject: "false" creationTimestamp: null labels: app.kubernetes.io/name: thanos-cleaner-cronjob spec: containers: - args: - /script/thanos-cleanup.sh command: - /bin/bash env: - name: NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace - name: THANOS_CONFIG_KEY value: thanos.yaml - name: DISABLE_BLOCK_CLEANER value: "false" image: docker.io/uipath/sf-k8-utils-rhel:SF_K8S_TAG imagePullPolicy: IfNotPresent name: thanos-cleaner resources: limits: cpu: 200m memory: 400Mi requests: cpu: 20m memory: 64Mi terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /script/ name: script - mountPath: /etc/thanos/ name: thanos-objectstore-vol - mountPath: /thanos-bin/ name: thanos - mountPath: /.kube/ name: kubedir - mountPath: /tmp/ name: tmpdir dnsPolicy: ClusterFirst initContainers: - args: - set -e; cp /bin/thanos /thanos-bin/thanos && chmod +x /thanos-bin/thanos command: - /bin/sh - -c image: ${thanosimage} imagePullPolicy: IfNotPresent name: copy-uipathcore-binary resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /thanos-bin/ name: thanos nodeSelector: kubernetes.io/os: linux restartPolicy: Never schedulerName: default-scheduler securityContext: fsGroup: 3000 runAsGroup: 2000 runAsNonRoot: true runAsUser: 1000 serviceAccount: thanos-cleaner serviceAccountName: thanos-cleaner terminationGracePeriodSeconds: 120 volumes: - emptyDir: {} name: kubedir - emptyDir: {} name: tmpdir - emptyDir: {} name: thanos - name: thanos-objectstore-vol secret: defaultMode: 420 secretName: thanos-objectstore-config - configMap: defaultMode: 420 name: thanos-cleaner-script name: script schedule: 0 1/6 * * * successfulJobsHistoryLimit: 2 suspend: false --- EOFthanosns=monitoring && if kubectl get application -n argocd rancher-monitoring; then thanosns=cattle-monitoring-system; fi && thanosimage=$(kubectl get statefulset -n $thanosns thanos-compact -o jsonpath='{.spec.template.spec.containers[0].image}') && cat <<EOF | kubectl apply -f - --- apiVersion: batch/v1 kind: CronJob metadata: name: thanos-cleaner namespace: ${thanosns} spec: concurrencyPolicy: Forbid failedJobsHistoryLimit: 3 jobTemplate: metadata: creationTimestamp: null spec: backoffLimit: 3 template: metadata: annotations: sidecar.istio.io/inject: "false" creationTimestamp: null labels: app.kubernetes.io/name: thanos-cleaner-cronjob spec: containers: - args: - /script/thanos-cleanup.sh command: - /bin/bash env: - name: NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace - name: THANOS_CONFIG_KEY value: thanos.yaml - name: DISABLE_BLOCK_CLEANER value: "false" image: docker.io/uipath/sf-k8-utils-rhel:SF_K8S_TAG imagePullPolicy: IfNotPresent name: thanos-cleaner resources: limits: cpu: 200m memory: 400Mi requests: cpu: 20m memory: 64Mi terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /script/ name: script - mountPath: /etc/thanos/ name: thanos-objectstore-vol - mountPath: /thanos-bin/ name: thanos - mountPath: /.kube/ name: kubedir - mountPath: /tmp/ name: tmpdir dnsPolicy: ClusterFirst initContainers: - args: - set -e; cp /bin/thanos /thanos-bin/thanos && chmod +x /thanos-bin/thanos command: - /bin/sh - -c image: ${thanosimage} imagePullPolicy: IfNotPresent name: copy-uipathcore-binary resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /thanos-bin/ name: thanos nodeSelector: kubernetes.io/os: linux restartPolicy: Never schedulerName: default-scheduler securityContext: fsGroup: 3000 runAsGroup: 2000 runAsNonRoot: true runAsUser: 1000 serviceAccount: thanos-cleaner serviceAccountName: thanos-cleaner terminationGracePeriodSeconds: 120 volumes: - emptyDir: {} name: kubedir - emptyDir: {} name: tmpdir - emptyDir: {} name: thanos - name: thanos-objectstore-vol secret: defaultMode: 420 secretName: thanos-objectstore-config - configMap: defaultMode: 420 name: thanos-cleaner-script name: script schedule: 0 1/6 * * * successfulJobsHistoryLimit: 2 suspend: false --- EOF