Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Stream Kubernetes Pod events to the Coder startup logs

License

NotificationsYou must be signed in to change notification settings

coder/coder-logstream-kube

discordreleasegodoclicense

Stream Kubernetes Pod events to the Coder startup logs.

  • Easily determine the reason for a pod provision failure, or why a pod is stuck in a pending state.
  • Visibility into when pods are OOMKilled, or when they are evicted.
  • Filter by namespace, field selector, and label selector to reduce Kubernetes API load.

Log Stream

Usage

Apply the Helm chart to start streaming logs into your Coder instance:

helm repo add coder-logstream-kube https://helm.coder.com/logstream-kubehelm install coder-logstream-kube coder-logstream-kube/coder-logstream-kube \    --namespace coder \    --set url=<your-coder-url-including-http-or-https>

Multi-Namespace support

By default, coder-logstream-kube will watch all namespaces in the cluster. To limit which namespaces are monitored, you can specify them in thevalues.yaml file:

# Watch specific namespaces onlynamespaces:["default", "kube-system"]# Watch all namespaces (default)namespaces:[]

Whennamespaces is empty or not specified, the service will monitor all namespaces in the cluster.

NoteFor additional customization (such as customizing the image, pull secrets, annotations, etc.), you can use thevalues.yaml file directly.

Your Coder template should be using akubernetes_deployment resource withwait_for_rollout set tofalse.

resource"kubernetes_deployment""hello_world" {count=data.coder_workspace.me.start_countwait_for_rollout=false...}

This ensures all pod events will be sent during initialization and startup.

How?

Kubernetes provides aninformers API that streams pod and event data from the API server.

coder-logstream-kube listens for pod creation events with containers that have theCODER_AGENT_TOKEN environment variable set. All pod events are streamed as logs to the Coder API using the agent token for authentication.

Custom Certificates

  • SSL_CERT_FILE: Specifies the path to an SSL certificate.
  • SSL_CERT_DIR: Identifies which directory to check for SSL certificate files.

Development

Running Tests

Unit tests can be run with:

go test ./... -race

Integration Tests

Integration tests run against a real Kubernetes cluster usingKinD (Kubernetes in Docker).

Prerequisites:

Setup and run:

#Create a KinD cluster./scripts/kind-setup.sh create#Run integration testsgo test -tags=integration -v ./...#Clean up whendone./scripts/kind-setup.sh delete

The integration tests validate:

  • Pod event streaming with real Kubernetes informers
  • ReplicaSet event handling
  • Multi-namespace support
  • Label selector filtering

About

Stream Kubernetes Pod events to the Coder startup logs

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors12


[8]ページ先頭

©2009-2025 Movatter.jp