Updating the Logging agent version by using a Helm chart
You can use Helm to update the Logging agent version.
Complete the following steps to update the agent version that is deployed in the cluster:
Before you begin
-
Make sure you have access to Kubernetes cluster with permissions to create namespaces and deploy the agent.
-
Install the following CLIs:
-
The IBM Cloud CLI to log in to the IBM Cloud and manage IBM Cloud services such as creating an API key.
-
The Kubernetes CLI to manage Kubernetes clusters by using
kubectl
commands. Learn more. -
The Openshift CLI to manage OpenShift clusters from the command line. Learn more.
-
-
Read about the Logging agent.
-
Check the agent versions that are available. For more information, see Checking the available agent versions. Note that the version of the Helm chart will match the version of the agent - for example, if you are using version 1.3.0 of the agent there's a Helm chart with version 1.3.0 that accompanies that version.
Step 1. Update the Helm chart values file for the Logging agent
Complete the following steps to modify the Helm chart with the agent version that you plan to deploy:
-
Update the file named
logs-values.yaml
with the following content:This file contains the configurations that are specific to your deployment.
metadata: name: "logs-agent" image: version: "1.4.0" # Modify the agent version and enter the version that you want to deploy clusterName: "ENTER_CLUSTER_NAME" # Enter the name of your cluster. This information is used to improve the metadata and help with your filtering. # enableMultiline: true # Set to true to enable multiline support for applications, like Java or Python, where errors and stack traces can span several lines, and each line is sent as a separate log entry. additionalMetadata: # add additional metadata, for example: region: au-syd env: production logging-agent-version: 1.4.0 # Enter the agent version that you want to deploy 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
Step 2. Update the agent
If you are using the iamMode
as IAMAPIKey
then the apikey needs to be present in a Kubernetes secret named logs-agent
with the key name IAM_API_KEY
. The secret can be created using the Helm
chart by including the --set secret.iamAPIKey=<your iamAPIKey>
option when running the helm install. If the secret has been created manually or if you are using iamMode=TrustedProfile
then do not include this
option.
Complete the following steps:
-
Log in to the cluster. For more information, see Access your cluster.
-
Log in to the Helm registry. Choose one of the following options:
Option 1: Login to the Helm registry by running the
helm registry login
command:helm registry login -u iambearer -p $(ibmcloud iam oauth-tokens --output json | jq -r .iam_token | cut -d " " -f2) icr.io
Windows Windows PowerShell users should use this command instead:
helm registry login -u iambearer -p ((ibmcloud iam oauth-tokens --output json | ConvertFrom-Json).iam_token -replace 'Bearer ', '') icr.io
For more information, see Using Helm charts in Container Registry: Pulling charts from another registry or Helm repository
Option 2: Log in to the Helm registry in Container Registry by running the
ibmcloud cr login
command.You can use the
ibmcloud cr login
command before you perform a Helm dry run or install. For more information, see Accessing Container Registry and ibmcloud cr login.Run the following commands:
ibmcloud cr region-set global
ibmcloud cr login [--client CLIENT]
-
Update the agent.
If you are using the
iamMode
=TrustedProfile
then the complete command is:helm update <install-name> oci://icr.io/ibm/observe/logs-agent-helm --version <chart-version> --values <PATH>/logs-values.yaml -n ibm-observe
If you are using the
iamMode
=IAMAPIKey
then the complete command is:helm update <install-name> oci://icr.io/ibm/observe/logs-agent-helm --version <chart-version> --values <PATH>/logs-values.yaml -n ibm-observe --create-namespace --set secret.iamAPIKey=<APIKey-value>
where:
<install-name>
is the name of the Helm installation (logging-agent
)<chart-version>
is the version of the helm chart. The Helm chart version should match the agent image version. For more information, see Helm chart versions.<PATH>
is the directory path where thelogs-values.yaml
file is located.<APIKey-value>
is the IAM apikey associated with the ServiceID.
For example, you can run the following command from the directory where the
logs-values.yaml
file is available:helm update logging-agent oci://icr.io/ibm/observe/logs-agent-helm --version 1.4.0 --values ./logs-values.yaml -n ibm-observe --set secret.iamAPIKey=<secret>
-
Restart the agent pods.
For Kubernetes clusters, run:
kubectl -n ibm-observe rollout restart ds/logs-agent
For OpenShift clusters, run:
oc -n ibm-observe rollout restart ds/logs-agent
Step 3. Verify logs are being delivered to your target destination
Complete the following steps:
-
When your agent is correctly configured, you can see logs through the default dashboard view. The Logging agent tags log records with a kubernetes object that includes the cluster name.
kubernetes.cluster_name:<CLUSTER_NAME>
You can run the query
kubernetes.cluster_name:<YOUR_CLUSTER_NAME>
in your IBM Cloud Logs instance to search for logs that are generated by your cluster.