-
Notifications
You must be signed in to change notification settings - Fork 894
docs: add coder-logstream-kube
docs and update k8s example template
#8675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
4dc50c1
docs: add kubestream docs and update example template
matifali 14c23bb
make fmt
matifali f1e385e
Merge branch 'main' into matifali/kubestream-docs
matifali 052715d
add to template's README
matifali 0068e3e
add the seperate page
matifali b0b82f5
make fmt
matifali 99bfef6
make fmt
matifali 02f2535
Merge branch 'main' into matifali/kubestream-docs
matifali c7b63ed
Merge branch 'main' into matifali/kubestream-docs
matifali 3f2614f
add namespace to deployment resource
matifali a2b5b5c
fmt
matifali 4e475df
add screenshots
matifali ae5e5fc
link docs in template
matifali d5db051
Add remaining examples
matifali 977d3bf
enable deployments requirement
matifali 0b404f2
Update deployment-logs.md
matifali 03e5774
rewording
matifali b91f573
Merge branch 'main' into matifali/kubestream-docs
matifali e4f3426
fix spelling
matifali ce62530
how?
matifali 5829684
cleanup
ericpaulsen bd80114
Update docs/platforms/kubernetes/deployment-logs.md
matifali ffae21c
suggestions
matifali 530c743
use online link
matifali e9b7373
refine
matifali 0f639b6
Merge branch 'main' into matifali/kubestream-docs
matifali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+96.5 KB
docs/platforms/kubernetes/coder-logstream-kube-logs-quota-exceeded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Kubernetes event logs | ||
|
||
To stream Kubernetes events into your workspace startup logs, you can use Coder's [`coder-logstream-kube`](https://github.com/coder/coder-logstream-kube) tool. `coder-logstream-kube` provides useful information about the workspace pod or deployment, such as: | ||
|
||
- Causes of pod provisioning failures, 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. | ||
matifali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Prerequisites | ||
matifali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
`coder-logstream-kube` works best with the [`kubernetes_deployment`](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/deployment) terraform resource, which requires the `coder` service account to have permission to create deployments. For example if you are using [helm](https://coder.com/docs/v2/latest/install/kubernetes#install-coder-with-helm) to install Coder, you should set `coder.serviceAccount.enableDeployments=true` in your `values.yaml` | ||
matifali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```diff | ||
coder: | ||
serviceAccount: | ||
workspacePerms: true | ||
- enableDeployments: false | ||
+ enableDeployments: true | ||
annotations: {} | ||
name: coder | ||
``` | ||
|
||
## Installation | ||
|
||
Install the `coder-kubestream-logs` helm chart on the cluster where the deployment is running. | ||
|
||
```shell | ||
helm repo add coder-logstream-kube https://helm.coder.com/logstream-kube | ||
helm install coder-logstream-kube coder-logstream-kube/coder-logstream-kube \ | ||
--namespace coder \ | ||
--set url=<your-coder-url-including-http-or-https> | ||
``` | ||
|
||
## Example logs | ||
|
||
Here is an example of the logs you can expect to see in the workspace startup logs: | ||
|
||
### Normal pod deployment | ||
|
||
 | ||
|
||
### Wrong image | ||
|
||
 | ||
|
||
### Kubernetes quota exceeded | ||
|
||
 | ||
|
||
### Pod crash loop | ||
|
||
 | ||
|
||
## How it works | ||
|
||
Kubernetes provides an [informers](https://pkg.go.dev/k8s.io/client-go/informers) API that streams pod and event data from the API server. | ||
|
||
coder-logstream-kube listens for pod creation events with containers that have the CODER_AGENT_TOKEN environment variable set. All pod events are streamed as logs to the Coder API using the agent token for authentication. For more details, see the [coder-logstream-kube](https://github.com/coder/coder-logstream-kube) repository. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.