Modello per distribuire il Agent di registrazione usando un diagramma Helm
È possibile utilizzare un grafico Helm per distribuire Agent di registrazione per raccogliere e instradare i registri dell'infrastruttura e delle applicazioni da un cluster Red Hat OpenShift on IBM Cloud (OpenShift) o da un cluster
Kubernetes a un'istanza IBM Cloud Logs.
Modello per distribuire il Agent di registrazione usando un grafico Helm su un cluster Openshift
metadata:
name: "logs-agent"
image:
version: "1.3.0" # required
clusterName: "" # Enter the name of your cluster. This information is used to improve the metadata and help with your filtering.
env:
# ingestionHost is a required field. For example:
# ingestionHost: "<logs instance>.ingress.us-east.logs.cloud.ibm.com"
ingestionHost: "" # required
# If you are using private CSE proxy, then use port number "3443"
# If you are using private VPE Gateway, then use port number "443"
# If you are using the public endpoint, then use port number "443"
ingestionPort: "" # required
iamMode: "TrustedProfile"
# trustedProfileID - trusted profile id - required if iamMode is set to "TrustedProfile"
trustedProfileID: ""
# Configure this parameter to control the IAM endpoint used by the agent to exchange the tokens.
# If omitted, the default value is "Production".
# Valid values are :
# "Production" to use the iam.cloud.ibm.com default endpoint
# "PrivateProduction" to use the private.iam.cloud.ibm.com endpoint
# "Custom" to use a custom provided IAM endpoint
iamEnvironment: "Production"
# iamHost - custom IAM endpoint (for example: private.eu-de.iam.cloud.ibm.com) - required if iamEnvironment is set to "Custom"
iamHost: ""
scc:
# true enables creation of Security Context Constraints in Openshift clusters
create: true
defaultMetadata:
# Configure to override the default subsystemName and applicationName that are used in the environment.
subsystemName: "" # The default value is set to the namespace that generated the log
applicationName: "" # The default value is set to the container name that generated the log
resources:
# Configure this section to change the resources that are assigned to the agent container.
limits:
cpu: 500m
ephemeral_storage: 10Gi
memory: 3Gi
requests:
cpu: 100m
ephemeral_storage: 2Gi
memory: 1Gi
# Configure these parameters to include, exclude or restrict the set of logs that are processed by the agent
# By default, the agent will collect the logs from `/var/log/containers/*.log`.
# Each field is set as comma separated list, for example “/var/log/abc/*.log,/var/log/xyz/*.log”
additionalLogSourcePaths: "" # adds locations to the default set of logs that will be processed.
excludeLogSourcePaths: "" # ignores logs in the specified locations.
selectedLogSourcePaths: "" # overrides the default path `/var/log/containers/*.log` and ignores the `additionalLogSourcePaths` configurations
# Configure this parameter to change the setting for the Kubernetes filter to include the annotations from Kubernetes with the log records.
# The default value for this setting is `false`.
includeAnnotations: true
# Configure this parameter to control the number of times the agent will retry sending data if an error occurs that is considered to be retryable.
# The default is `False`.
# For more information, see the [Fluentbit documentation about retries](https://docs.fluentbit.io/manual/administration/scheduling-and-retries) to understand the implications of setting this value.
retryLimit: False
# Configure additional tags as key/value pair tags that can be added as metadata to every log line.
additionalMetadata:
# region: ca-tor
# env: production
# Configure the level of logging
# Default value is info
# Valid values are: debug, info, or error
loggingLevel: info
Modello per distribuire il Agent di registrazione usando un grafico Helm su un cluster Kubernetes
metadata:
name: "logs-agent"
image:
version: "1.3.0" # required
clusterName: "" # Enter the name of your cluster. This information is used to improve the metadata and help with your filtering.
env:
# ingestionHost is a required field. For example:
# ingestionHost: "<logs instance>.ingress.us-east.logs.cloud.ibm.com"
ingestionHost: "" # required
# If you are using private CSE proxy, then use port number "3443"
# If you are using private VPE Gateway, then use port number "443"
# If you are using the public endpoint, then use port number "443"
ingestionPort: "" # required
iamMode: "TrustedProfile"
# trustedProfileID - trusted profile id - required for iam trusted profile mode
trustedProfileID: "" # required if iamMode is set to TrustedProfile
# Configure this parameter to control the IAM endpoint used by the agent to exchange the tokens.
# If omitted, the default value is "Production".
# Valid values are :
# "Production" to use the iam.cloud.ibm.com default endpoint
# "PrivateProduction" to use the private.iam.cloud.ibm.com endpoint
# "Custom" to use a custom provided IAM endpoint
iamEnvironment: "Production"
# iamHost - custom IAM endpoint (for example: private.eu-de.iam.cloud.ibm.com) - required if iamEnvironment is set to "Custom"
iamHost: ""
scc:
# true enables creation of Security Context Constraints in Openshift clusters
# set to false for Kubernetes clusters
create: false
defaultMetadata:
# Configure to override the default subsystemName and applicationName that are used in the environment.
subsystemName: "" # The default value is set to the namespace that generated the log
applicationName: "" # The default value is set to the container name that generated the log
resources:
# Configure this section to change the resources that are assigned to the agent container.
limits:
cpu: 500m
ephemeral_storage: 10Gi
memory: 3Gi
requests:
cpu: 100m
ephemeral_storage: 2Gi
memory: 1Gi
# Configure these parameters to include, exclude or restrict the set of logs that are processed by the agent
# By default, the agent will collect the logs from `/var/log/containers/*.log`.
# Each field is set as comma separated list, for example “/var/log/abc/*.log,/var/log/xyz/*.log”
additionalLogSourcePaths: "" # adds locations to the default set of logs that will be processed.
excludeLogSourcePaths: "" # ignores logs in the specified locations.
selectedLogSourcePaths: "" # overrides the default path `/var/log/containers/*.log` and ignores the `additionalLogSourcePaths` configurations
# Configure this parameter to change the setting for the Kubernetes filter to include the annotations from Kubernetes with the log records.
# The default value for this setting is `false`.
includeAnnotations: true
# Configure this parameter to control the number of times the agent will retry sending data if an error occurs that is considered to be retryable.
# The default is `False`.
# For more information, see the [Fluentbit documentation about retries](https://docs.fluentbit.io/manual/administration/scheduling-and-retries) to understand the implications of setting this value.
retryLimit: False
# Configure additional tags as key/value pair tags that can be added as metadata to every log line.
additionalMetadata:
# region: ca-tor
# env: production
# Configure the level of logging
# Default value is info
# Valid values are: debug, info, or error
loggingLevel: info
Opzioni di configurazione del diagramma Helm
La tabella seguente contiene un elenco dei parametri che si possono configurare nel file logs-values.yaml per regolare le configurazioni di Agent di registrazione:
| Parametro | Descrizione | Condizione | Valore predefinito |
|---|---|---|---|
metadata.name |
Il nome dell'agente utilizzato per tutte le risorse Kubernetes | Obbligatorio | logs-agent |
image.version |
La versione dell'immagine del contenitore dell'agente (ad esempio, 1.3.0) | Obbligatorio | Nessun valore predefinito |
env.ingestionHost |
L'host IBM Cloud Logs a cui inviare i logs | Obbligatorio | Nessun valore predefinito |
env.ingestionPort |
La porta IBM Cloud Logs a cui inviare i logs | Obbligatorio | Nessun valore predefinito |
env.iamMode |
Indicare il meccanismo di autenticazione IAM utilizzato. I valori validi sono: TrustedProfile o IAMAPIKey |
Obbligatorio | TrustedProfile |
env.trustedProfileID |
L'ID del profilo attendibile. | Questo parametro è necessario quando iamMode=TrustedProfile |
Nessun valore predefinito |
env.iamEnvironment |
Controlla l'endpoint IAM utilizzato dall'agente per scambiare i token Per ulteriori informazioni, vedere iamEnvironment. |
Obbligatorio | Production |
env.iamHost |
Nome host utilizzato per l'ambiente IAM personalizzato. | Necessario se iamEnviroment è impostato su Custom. |
Nessun valore predefinito |
secret.iamAPIKey |
L'ID della chiave API. Questo valore deve essere fornito solo tramite la CLI. Per ulteriori informazioni, vedere env.iamMode. |
Questo parametro è necessario quando iamMode=IAMAPIKey |
Nessun valore predefinito |
clusterName |
Il nome del cluster kubernetes | Facoltativo | Nessun valore predefinito |
scc.create |
Indica quando creare i vincoli del contesto sicuro in Openshift | Richiesto solo per le distribuzioni di cluster Openshift. | false |
defaultMetadata.subsystemName |
Stringa statica per sovrascrivere l'impostazione subsystemName in IBM Cloud Logs | Facoltativo | Il valore predefinito è impostato sullo spazio dei nomi che ha generato il log |
defaultMetadata.applicationName |
Stringa statica per sovrascrivere il applicationName in IBM Cloud Logs | Facoltativo | Il valore predefinito è impostato sul nome del contenitore che ha generato il log |
resources |
Sovrascrivere le risorse kubernetes allocate al logs-agent | Facoltativo | Vedere Risorse per vedere i valori predefiniti |
additionalLogSourcePaths |
Il percorso dei registri aggiuntivi oltre a quello predefinito. /var/log/containers/*.log Per ulteriori informazioni, vedere Configurazioni dei percorsi delle origini dei registri. |
Facoltativo | Nessun valore predefinito |
excludeLogSourcePaths |
Il percorso dei log aggiuntivi che non devono essere raccolti dall'agente Per ulteriori informazioni, vedere Configurazioni dei percorsi delle sorgenti dei registri. |
Facoltativo | Nessun valore predefinito |
selectedLogSourcePaths |
Il percorso dei log che vengono raccolti dall'agente, escludendo il percorso predefinito e qualsiasi file configurato in additionalLogSourcePathsPer ulteriori informazioni, vedere Configurazioni dei percorsi delle sorgenti dei registri. |
Facoltativo | Nessun valore predefinito |
includeAnnotations |
Indica al plugin kubernetes di includere le annotazioni del contenitore con i messaggi di log Per ulteriori informazioni, vedere [includeAnnotations#agent-helm-template-clusters-chart-options-include-annotations]). |
Obbligatorio | false |
retryLimit |
Limita il numero di tentativi di Per ulteriori informazioni, vedere retryLimit |
Obbligatorio | False |
loggingLevel |
Il tipo di log che deve essere segnalato dall'agente stesso. I valori validi sono: debug, info, o error. |
Obbligatorio | info |
additionalMetadata |
Un elenco di tag a coppia chiave/valore che possono essere aggiunti come metadati a ogni riga di log Per ulteriori informazioni, vedere additionalMetadata. |
Facoltativo | Nessun valore predefinito |
env.iamMode
Configurare questo parametro per scegliere il metodo di autenticazione che l'agente deve usare quando invia i registri a un'istanza IBM Cloud Logs.
- È possibile scegliere una configurazione di APIKey IAM o di Profilo attendibile.
- I valori validi sono:
TrustedProfileoIAMAPIKey - Il valore predefinito è una configurazione del profilo di fiducia.
La voce nel file logs-values.yaml si presenta come segue:
env:
iamMode: IAMAPIKey
Per l'impostazione di questo parametro, tenere conto delle seguenti informazioni:
-
Se
env.iamMode: "TrustedProfile"è impostato, deve essere fornita anche la variabileenv.trustedProfileID. -
Se
env.iamMode: "IAMAPIKey"è impostato, la configurazione si aspetta che venga definito un segreto che contenga una Apikey IAM con le autorizzazioni.Se la variabile "
secret.iamAPIKey" è fornita sul comando del timone (ad esempio "--set secret.iamAPIKey=<your iamAPIKey>"), la carta del timone creerà il segreto " Kubernetes ".In alternativa, è possibile creare il segreto in anticipo con il comando: (Assicuratevi di essere connessi al vostro cluster)
kubectl create secret generic <helm install-name> -n ibm-observe --from-literal=IAM_API_KEY=<apikey>
defaultMetadata
Questa sezione consente all'utente di sovrascrivere i nomi predefiniti di subsystemName e applicationName utilizzati nell'ambiente. Per impostazione predefinita, i valori non sono impostati e il plugin di output li imposterà dinamicamente:
- subsystemName: il namespace Kubernetes che ha generato il log
- applicationName: il nome del contenitore che ha generato il registro
La voce nel file logs-values.yaml si presenta come segue:
defaultMetadata:
subsystemName: ""
applicationName: ""
resources
Questa sezione consente all'utente di modificare le risorse assegnate al contenitore Agent di registrazione.
La voce nel file logs-values.yaml ha il seguente aspetto e imposta i seguenti valori predefiniti:
resources:
limits:
cpu: 500m
ephemeral_storage: 10Gi
memory: 3Gi
requests:
cpu: 100m
ephemeral_storage: 2Gi
memory: 1Gi
Se è necessario aggiornare uno dei valori, è necessario fornire l'intera configurazione, anche se non si aggiornano tutti i valori.
Configurazioni dei percorsi delle sorgenti dei registri
Per impostazione predefinita, l'agente raccoglie i registri da /var/log/containers/*.log.
Le seguenti variabili aggiuntive possono essere fornite per includere, escludere o limitare l'insieme dei registri da elaborare:
additionalLogSourcePathsaggiunge posizioni all'insieme predefinito di registri che verranno elaborati.excludeLogSourcePathsignora i registri nelle posizioni specificate.selectedLogSourcePathssostituisce il percorso predefinito/var/log/containers/*.loge ignora le configurazioni diadditionalLogSourcePaths. Solo i file impostati tramite questo parametro vengono raccolti dall'agente.
È possibile definire più percorsi utilizzando un elenco separato da virgole, ad esempio "/var/log/abc/.log,/var/log/xyz/.log".
La voce nel file logs-values.yaml si presenta come segue:
# comma separated list, for example “/var/log/abc/*.log,/var/log/xyz/*.log”
additionalLogSourcePaths: ""
excludeLogSourcePaths: ""
selectedLogSourcePaths: ""
env.iamEnvironment
Questa configurazione controlla l'endpoint IAM utilizzato dall'agente per lo scambio dei token.
Il valore predefinito è Production.
I valori validi sono :
- Imposta
Productionper utilizzare l'endpointiam.cloud.ibm.compredefinito - Imposta
PrivateProductionper utilizzare l'endpointprivate.iam.cloud.ibm.com - Impostare
Customper utilizzare un endpoint IAM personalizzato (ad esempio private.eu-de.iam.cloud.ibm.com )
La voce nel file logs-values.yaml si presenta come segue:
env:
iamEnvironment: "Production"
Per l'impostazione dell' Custom iamEnvironment, deve essere fornito anche l' iamHost.
env:
iamEnvironment: "Custom"
iamHost: "private.eu-de.iam.cloud.ibm.com"
includeAnnotations
Questa configurazione modifica l'impostazione del filtro Kubernetes per includere le annotazioni di Kubernetes nei record di log.
Il valore predefinito per questa impostazione è false.
La voce nel file logs-values.yaml si presenta come segue:
includeAnnotations: true
retryLimit
Questa configurazione pone un limite al numero di volte in cui l'agente riprova a inviare i dati se si verifica un errore considerato riproducibile.
Il valore predefinito è False.
Per ulteriori informazioni, consultare la documentazione di Fluentbit sui tentativi per comprendere le implicazioni dell'impostazione di questo valore.
In alcune situazioni questa impostazione potrebbe portare all'eliminazione dei dati di log da parte dell'agente a causa dell'impossibilità di inviarli.
La voce nel file logs-values.yaml si presenta come segue:
retryLimit: 8
additionalMetadata
Si tratta di un elenco di coppie chiave/valore che verranno aggiunte sotto l'oggetto meta per consentire l'inserimento di tag aggiuntivi.
La voce nel file logs-values.yaml si presenta come segue:
additionalMetadata:
region: ca-tor
env: production
L'esempio sopra riportato comporta l'aggiunta dei seguenti campi a ogni riga di log in IBM Cloud Logs:
{
"meta": {
"region": "ca-tor",
"env": "production"
}
}