T4K Log Collector Plugin

This page describes how to setup the T4K log collector and collect logs for support analysis

tvk-log-collector collects the logs, config and events of resources. Pod Logs can help you understand what is happening inside your application. The logs are particularly useful for debugging problems and monitoring cluster activity, alongside the metadata of all resources related to Trilio as either namespaced by providing namespaces name separated by comma or clustered from k8s cluster for debugging k8s-triliovault application. It also collects the CRDs yaml related to T4K and zip them.

Pre-requisites:

  1. krew - kubectl-plugin manager. Install from here

  2. kubectl - kubernetes command-line tool. Install from here

Supported OS and Architectures:

  • linux/amd64

  • linux/x86

  • linux/arm

  • linux/arm64

  • darwin/amd64

  • darwin/arm64

  • windows/amd64

Installation, Upgrade, Removal of Plugins :

With krew:

  • Add T4K custom plugin index of krew:

    kubectl krew index add tvk-plugins https://github.com/trilioData/tvk-plugins.git
  • Installation:

    kubectl krew install tvk-plugins/tvk-log-collector
  • Upgrade:

    kubectl krew upgrade tvk-log-collector
  • Removal:

    kubectl krew uninstall tvk-log-collector

Without krew:

  1. Choose a version of log-collector plugin to install and check if release assets have log-collector plugin's package [log-collector_${version}${OS}${ARCH}.tar.gz] for your desired OS & Architecture.

    • To check OS & Architecture, execute command uname -a on linux/macOS and systeminfo on windows

  2. Set env variable version=v1.x.x [update with your desired version]. If version is not exported, latest tagged version will be considered.

Linux/macOS

  • Bash or ZSH shells

(
  set -ex; cd "$(mktemp -d)" &&
  OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
  ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
  if [[ -z ${version} ]]; then version=$(curl -s https://api.github.com/repos/trilioData/tvk-plugins/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'); fi &&
  echo "Installing version=${version}" &&
  package_name="log-collector_${version}_${OS}_${ARCH}.tar.gz" &&
  curl -fsSLO "https://github.com/trilioData/tvk-plugins/releases/download/"${version}"/${package_name}" &&
  tar zxvf ${package_name} && sudo mv log-collector /usr/local/bin/kubectl-tvk_log_collector
)

Verify installation with kubectl tvk-log-collector --help

Windows

  1. Download log-collector_${version}_windows_${ARCH}.zip from the Releases page to a directory and unzip the package.

  2. Launch a command prompt (log-collector.exe).

Note for Dark Site Installation

Krew plugin installation is not required, as it is a part of Dark Site Installer Package.

Usage:

kubectl tvk-log-collector [flags]

Flags:

Examples

  • To collect logs & YAML from multiple namespaces (separated by commas in double quotes):

      kubectl tvk-log-collector --namespaces "<ns1>,<ns2>" --log-level info
  • To collect logs & YAML from all over the cluster:

      kubectl tvk-log-collector --clustered --log-level info
  • To collect logs with log level error and to keep the folder with & without zip:

      kubectl tvk-log-collector --clustered --keep-source-folder --log-level error
  • To collect logs by providing object gvk which log collector doesn't collect by default :

      kubectl tvk-log-collector --clustered --gvks "/v1/pod","apps//Deployment"
  • To collect object logs by providing labels which log collector doesn't collect by default :

      kubectl tvk-log-collector --clustered  --labels "app=frontend,custom=label","app=backend"
  • To collect logs by providing config file :

      kubectl tvk-log-collector --config-file <path/to/config/file.yaml>

The format of data in a file should be according to the below example:

keep-source-folder: true
clustered: false
namespaces:
  - default
  - tvk
logLevel: INFO
kubeConfig: path/to/config
labels:
  - matchLabels:
      "app": "frontend"
      "custom": "label"
  - matchLabels:
      "app": "backend"
gvks:
  - group: ""
    version: ""
    kind: pod
  - group: apps
    version: ""
    kind: Deployment

Run a log collector with predefined values using a sample file. Download the file using below commands:

By wget

wget https://raw.githubusercontent.com/trilioData/tvk-plugins/main/docs/log-collector/sample_input.yaml

By curl

curl https://raw.githubusercontent.com/trilioData/tvk-plugins/main/docs/log-collector/sample_input.yaml -o sample_input.yaml

Output

This command will create triliovault-<date-time>.zip zip file containing cluster debugging information.

Resources Considered for Log Collection:

CustomResourceDefinition  
VolumeSnapshots  
VolumeSnapshotClass  
StorageClass  
Jobs  
Pods  
DaemonSets  
Deployments  
ReplicaSets  
StatefulSet  
PersistentVolumeClaims  
PersistentVolumes  
Services  
ServiceAccounts
Endpoints
Ingress
Events
ConfigMap
LimitRange
ResourceQuota
Role
RoleBinding
Namespaces
Nodes

When clustered flag enabled:

ClusterRole
ClusterRoleBinding
MutatingWebhookConfiguration
ValidatingWebhookConfiguration
PersistentVolume
IngressClass

and Trilio Resources

OCP Specific Resources Considered for Log Collection:

ClusterServiceVersion  
CatalogSource
InstallPlan
OperatorCondition
Route
Subscription

Last updated