CONFIG.SYS
  • ALL_POSTS.BAT
  • ABOUT.EXE

Using flux cli to trace k8s resources - Thu, Mar 31, 2022

Using flux cli to trace k8s resources

In my current project we are doing GitOps with flux . That means all the changes are done in our projects ind GitLab and then automatically reconciled in the cluster.
As more and more components are deployed that way, it is sometimes helpful to get a quick overview where the resulting k8s object came from.
The flux trace command of the cli does exactly that. Here is an example of tracing a Pod:

flux trace -n banking-app debugger-577d68c754-9kc4h --kind Pod --api-version=v1

Object:         Pod/account-service-577d68c754-9kc4h
Namespace:      banking
Status:         Managed by Flux
---
HelmRelease:    account-service
Namespace:      banking
Target:         banking
Revision:       1.0.26
Status:         Last reconciled at 2022-03-29 11:37:11 +0200 CEST
Message:        Release reconciliation succeeded
---
HelmChart:      banking-account-service
Namespace:      banking
Chart:          account-service
Version:        *
Revision:       1.0.26
Status:         Last reconciled at 2022-03-29 11:36:44 +0200 CEST
Message:        packaged 'account-service' chart with version '1.0.26'
---
GitRepository: account-service-repo
Namespace:     banking
URL:           https://gitlab.com/tom1299/banking/account-service.git
Tag:           1.0.26
Revision:      1.0.26/f64a70625f26cf01d1f695041be88a747841a250
Status:        Last reconciled at 2022-03-29 11:36:44 +0200 CEST
Message:       stored artifact for revision '1.0.26/f64a70625f26cf01d1f695041be88a747841a250'

The trace goes from the Pod itself, to the HelmRelease , the Helm chart to the Git repository where the sources of the service are located. It even contains the commit SHA-1 hash so the current deployment can be traced to the exact commit. So you always know where to start looking when something goes wrong.
On a side note, the Deployment and ReplicaSet created are not contained in the trace.

Back to Home


21st century version | © Thomas Reuhl 2020-2022 | Disclaimer | Built on Hugo

Linkedin GitHub