- Vue d'ensemble (Overview)
- Prérequis
- Modèles de déploiement
- Manuel : Préparation de l'installation
- Manuel : Préparation de l'installation
- Étape 2 : configurer le registre compatible OCI pour les installations hors ligne
- Étape 3 : configurer le magasin d’objets externe
- Étape 4 : Configuration de High Availability Add-on
- Étape 5 : configurer les bases de données SQL
- Étape 6 : configurer l’équilibreur de charge
- Étape 7 : configurer le DNS
- Étape 8 : configuration des disques
- Étape 9 : configurer les paramètres au niveau du noyau et du système d’exploitation
- Étape 10 : configuration des ports de nœud
- Étape 11 : appliquer divers paramètres
- Étape 12 : Valider et installer les packages RPM requis
- Étape 13 : génération du fichier cluster_config.json
- Configuration du certificat
- Configuration de la base de données
- Configuration du magasin d'objets externe
- Configuration d'URL pré-signée
- Configuration de l'authentification Kerberos
- Configuration du registre externe compatible OCI
- Disaster Recovery : configurations actif/passif et actif/actif
- Configuration de High Availability Add-on
- Configuration spécifique à Orchestrator
- Configuration spécifique à Insights
- Configuration spécifique à Process Mining
- Configuration spécifique à Document Understanding
- Configuration spécifique à Automation Suite Robots
- Configuration de la surveillance
- Facultatif : configuration du serveur proxy
- Facultatif : Activation de la résilience aux échecs locaux dans un cluster en mode production multi-nœuds compatible haute disponibilité
- Facultatif : Transmettre le fichier personnalisé resolv.conf
- Facultatif : augmentation de la tolérance aux pannes
- install-uipath.sh parameters
- Ajout d'un nœud d'agent dédié avec prise en charge GPU
- Ajout d'un nœud d'agent dédié pour Task Mining
- Connexion de l'application Task Mining
- Ajout d'un nœud d'agent dédié pour les Automation Suite Robots
- Étape 15 : configuration du registre Docker temporaire pour les installations hors ligne
- Étape 16 : validation des prérequis de l’installation
- Manuel : Exécution de l'installation
- Post-installation
- Administration du cluster
- Gestion des produits
- Premiers pas avec le portail d'administration du cluster
- Migration de High Availability Add-on du cluster vers une version externe
- Migration du registre intégré au cluster vers un registre externe compatible OCI
- Basculer manuellement vers le cluster secondaire dans une configuration actif/passif
- Disaster Recovery : exécution d'opérations post-installation
- Conversion d'une installation existante en configuration multi-sites
- Recommandations pour mettre à niveau un déploiement actif/passif ou actif/actif
- Recommandations pour sauvegarder et restaurer un déploiement actif/passif ou actif/actif
- Rediriger vers le cluster principal le trafic pour les services non pris en charge
- Mise à l'échelle d'un déploiement à nœud unique (évaluation) vers un déploiement multi-nœuds (HA)
- Surveillance et alerte
- Migration et mise à niveau
- Étape 1 : Déplacement des données d'organisation Identity d'installation autonome vers Automation Suite
- Étape 2 : Restauration de la base de données du produit autonome
- Étape 3 : Sauvegarder la base de données de la plate-forme dans Automation Suite
- Étape 4 : Fusion des organisations dans Automation Suite
- Étape 5 : Mise à jour des chaînes de connexion du produit migré
- Étape 6 : migration de la version autonome d'Orchestrator
- Étape 7 : Migration d’Insights en version autonome
- Étape 8 : Migration de Test Manager autonome
- Étape 9 : suppression du locataire par défaut
- Exécution d'une seule migration de locataire
- Migration d'Automation Suite sur Linux vers Automation Suite sur EKS/AKS
- Mettre à niveau Automation Suite
- Téléchargement des packages d'installation et obtention de l'ensemble des fichiers sur le premier nœud de serveur
- Récupération de la dernière configuration appliquée à partir du cluster
- Mise à jour de la configuration du cluster
- Configuration du registre compatible OCI pour les installations hors ligne
- Exécution de la mise à niveau
- Exécution d'opérations post-mise à niveau
- Configuration spécifique au produit
- Utilisation de l'outil Orchestrator Configurator
- Configuration des paramètres d'Orchestrator
- Paramètres de l'application Orchestrator
- Configuration des paramètres d'application
- Configuration de la taille maximale de la requête
- Remplacement de la configuration du stockage au niveau du cluster
- Configuration des magasins d'informations d'identification
- Configuration de la clé de chiffrement par locataire
- Nettoyer la base de données Orchestrator
- Rotation des informations d’identification de stockage d’objets blob
- Désactivation de l'utilisation d'URL pré-signées lors du téléchargement de données vers le stockage Amazon S3
- Configuration de la sécurité de l'application de processus
- Configurer une authentification Kerberos avec l’authentification MSSQL de base pour Process Mining
- Bonnes pratiques et maintenance
- Résolution des problèmes
- Comment résoudre les problèmes des services lors de l'installation
- Comment désinstaller le cluster
- Comment nettoyer les artefacts hors ligne pour améliorer l'espace disque
- Comment effacer les données Redis
- Comment activer la journalisation Istio
- Sortie de Ceph du mode lecture seule
- Comment nettoyer les anciens journaux stockés dans le compartiment sf-logs
- Comment désactiver les journaux de diffusion pour AI Center
- Comment déboguer les installations d'Automation Suite ayant échoué
- Comment supprimer des images de l’ancien programme d’installation après la mise à niveau
- Comment désactiver le déchargement de la somme de contrôle txt
- Comment mettre à niveau Automation Suite 2022.10.10 et 2022.4.11 vers 2023.10.2
- Comment définir manuellement le niveau de journalisation d’ArgoCD sur Info
- Comment augmenter le stockage d’AI Center
- Comment générer la valeur pull_secret_value encodée pour les registres externes
- Comment résoudre les chiffrements faibles dans TLS 1.2
- Comment travailler avec les certificats
- Comment transférer les journaux d'application vers Splunk
- Comment nettoyer les images Docker inutilisées à partir des pods de registre
- Comment collecter les données d'utilisation de DU avec le magasin d'objets intégré au cluster (Ceph)
- Comment installer RKE2 SELinux dans des environnements isolés
- Comment nettoyer les anciennes sauvegardes différentielles sur un serveur NFS
- Impossible d'exécuter une installation hors ligne sur le système d'exploitation RHEL 8.4
- Erreur lors du téléchargement du bundle
- L'installation hors ligne échoue en raison d'un fichier binaire manquant
- Échec de la vérification des prérequis pour le module selinux iscsid
- Disque Azure non marqué comme SSD
- Échec après la mise à jour du certificat
- L'antivirus provoque des problèmes d'installation
- Automation Suite ne fonctionne pas après la mise à niveau du système d'exploitation
- Automation Suite requiert que backlog_wait_time soit défini sur 0
- Volume impossible à monter car il n'est pas prêt pour les charges de travail
- Échec de la collecte du journal du pack d'assistance
- La chaîne de connexion SQL de l’automatisation de test est ignorée
- Paramètres DNS non respectés par CoreDNS
- Perte de données lors de la réinstallation ou de la mise à niveau d'Insights après la mise à niveau d'Automation Suite
- Échec de la mise à niveau du nœud unique à l’étape Fabric
- Échec de la mise à niveau en raison d’un Ceph défectueux
- Le volume ne peut pas être monté et reste à l'état de boucle d'attachement/détachement
- La mise à niveau échoue en raison d’objets classiques dans la base de données Orchestrator
- Cluster Ceph trouvé dans un état dégradé après une mise à niveau côte à côte
- Un composant Insights défectueux entraîne l’échec de la migration
- La mise à niveau du service échoue pour Apps
- Délais d'attente de mise à niveau sur place
- Migration du registre Docker bloquée lors de la suppression du PVC
- Échec de l’enregistrement d’AI Center après la mise à niveau vers la version 2023.10 ou une version ultérieure
- La mise à niveau échoue dans les environnements hors ligne
- Échec de la validation SQL lors de la mise à niveau
- Le pod d'instantané-contrôleur-crds dans l'état CrashLoopBackOff après la mise à niveau
- Erreur de mise à niveau/réinstallation du point de terminaison de l'API REST Longhorn
- La mise à niveau échoue en raison du remplacement des tailles de PVC Insights
- La mise à niveau du service échoue lors de l'exécution du script de pré-service
- Échec du chargement ou du téléchargement des données dans l'objectstore
- Le redimensionnement de la PVC ne répare pas Ceph
- Échec du redimensionnement du PVC objectstore
- Erreur de pièce jointe du volume Ensembles d'états.
- Rook Ceph ou pod Looker bloqué dans l'état Init
- Échec de la compression des métriques en raison de blocs corrompus dans Thanos
- Définition d'un délai d'expiration pour les portails de gestion
- L'authentification ne fonctionne pas après la migration
- kinit : Impossible de trouver le KDC pour le domaine <AD Domain> lors de l'obtention des informations d'identification initiales
- Kinit : Keytab ne contient aucune clé appropriée pour *** lors de l'obtention des informations d'identification initiales
- L'opération GSSAPI a échoué en raison d'un code de statut non valide
- Alarme reçue pour l'échec de la tâche Kerberos-tgt-update
- Fournisseur SSPI : serveur introuvable dans la base de données Kerberos
- La connexion a échoué pour l'utilisateur AD en raison d'un compte désactivé
- Échec de connexion à ArgoCD
- Impossible d'obtenir l'image du bac à sable
- Les pods ne s'affichent pas dans l'interface utilisateur ArgoCD
- Échec de la sonde Redis
- Le serveur RKE2 ne démarre pas
- ArgoCD passe à l'état Progression (Progressing) après la première installation
- Atténuation manuelle de la politique réseau ArgoCD
- Services défectueux après la restauration ou l'annulation du cluster
- Métriques Ceph-rook manquantes dans les tableaux de bord de surveillance
- Les pods ne peuvent pas communiquer avec le nom de domaine complet dans un environnement proxy
- Échec de la configuration des alertes par e-mail après la mise à niveau
- Aucun problème sain en amont
- Échec de l'ajout de nœuds d'agent dans les environnements hors ligne
- L'accès au nom de domaine complet renvoie RBAC : erreur d'accès refusé
- Document Understanding n'est pas affiché sur la barre de gauche d'Automation Suite
- État Échec (Failed) lors de la création d'une session de labellisation des données
- État Échec (Failed) lors de la tentative de déploiement d'une compétence ML
- La tâche de migration échoue dans ArgoCD
- La reconnaissance de l'écriture manuscrite avec l'Extracteur de formulaires intelligents (Intelligent Form Extractor) ne fonctionne pas
- Échec du déploiement de la compétence ML en raison de l'expiration du jeton
- Exécution de la haute disponibilité avec Process Mining
- Échec de l’ingestion de Process Mining lors de la connexion à l’aide de Kerberos
- Après Disaster Recovery, Dapr ne fonctionne pas correctement pour Process Mining
- Configuration de Dapr avec Redis en mode cluster
- Impossible de se connecter à la base de données AutomationSuite_ProcessMining_Authentication à l'aide d'une chaîne de connexion au format pyodbc
- L'installation d'airflow échoue avec sqlalchemy.exc.ArgumentError: impossible d'analyser l'URL rfc1738 de la chaîne ''
- Comment ajouter une règle de table d'adresse IP pour utiliser le port SQL Server 1433
- Le certificat Automation Suite n'est pas approuvé depuis le serveur sur lequel CData Sync est en cours d'exécution
- Exécution de l'outil de diagnostic
- Utilisation du pack d'assistance Automation Suite
- Explorer les journaux
Échec de la compression des métriques en raison de blocs corrompus dans Thanos
Corrigez les défaillances du compacteur Thanos causées par des blocs corrompus dans le magasin d’objets d’Automation Suite afin d’éviter une utilisation excessive du stockage du compartiment Ceph.
Description
Le compacteur Thanos peut ne pas compacter les métriques lorsque des blocs corrompus sont détectés dans le magasin d’objets. Cette condition empêche le compacteur de traiter les métriques, ce qui entraîne une utilisation accrue du stockage dans le compartiment Ceph.
Solution
Pour résoudre ce problème, procédez comme suit :
- Sur n'importe quel nœud de serveur, exécutez le script suivant :
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/fr/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 - Sur n'importe quel nœud de serveur, exécutez le script suivant :
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: cattle-monitoring-system --- 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: cattle-monitoring-system --- EOF - Remplacez
SF_K8S_TAGpar la balise d'image correcte, puis appliquez l'élément cronjob.
Depuis le répertoire du programme d'installation sur n'importe quel nœud de serveur, obtenez la dernière balise :
cat versions/docker-images.json |grep uipath/sf-k8-utils-rhel | tr -d ',"' | awk -F ':' '{print $2}' |sort |uniq |tail -1
cat versions/docker-images.json |grep uipath/sf-k8-utils-rhel | tr -d ',"' | awk -F ':' '{print $2}' |sort |uniq |tail -1
Mettez ensuite à jour le bloc cronjob en remplaçant SF_K8S_TAG par la valeur renvoyée.
Une fois mis à jour, collez l'intégralité du bloc dans le terminal d'un nœud de serveur :
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
---
EOF
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
---
EOF