You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
4
+
5
+
- Causes of pod provisioning failures, or why a pod is stuck in a pending state.
6
+
- Visibility into when pods are OOMKilled, or when they are evicted.
7
+
8
+
## Prerequisites
9
+
10
+
`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 use [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`
11
+
12
+
```diff
13
+
coder:
14
+
serviceAccount:
15
+
workspacePerms: true
16
+
- enableDeployments: false
17
+
+ enableDeployments: true
18
+
annotations: {}
19
+
name: coder
20
+
```
21
+
22
+
> Note: This is only required for Coder versions < 0.28.0, as this will be the default value for Coder versions >= 0.28.0
23
+
24
+
## Installation
25
+
26
+
Install the `coder-kubestream-logs` helm chart on the cluster where the deployment is running.
Kubernetes provides an [informers](https://pkg.go.dev/k8s.io/client-go/informers) API that streams pod and event data from the API server.
58
+
59
+
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.
Copy file name to clipboardExpand all lines: examples/templates/kubernetes/README.md
+31-2Lines changed: 31 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,23 @@ icon: /icon/k8s.png
7
7
8
8
# Getting started
9
9
10
-
This template creates a pod running the `codercom/enterprise-base:ubuntu` image.
10
+
This template creates a deplyment running the `codercom/enterprise-base:ubuntu` image.
11
+
12
+
## Prerequisites
13
+
14
+
This template uses [`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 deploymnets. 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`
15
+
16
+
```diff
17
+
coder:
18
+
serviceAccount:
19
+
workspacePerms: true
20
+
- enableDeployments: false
21
+
+ enableDeployments: true
22
+
annotations: {}
23
+
name: coder
24
+
```
25
+
26
+
> Note: This is only required for Coder versions < 0.28.0, as this will be the default value for Coder versions >= 0.28.0
11
27
12
28
## Authentication
13
29
@@ -62,7 +78,7 @@ You may want to deploy workspaces on a cluster outside of the Coder control plan
62
78
63
79
## Namespace
64
80
65
-
The target namespace in which the pod will be deployed is defined via the `coder_workspace`
81
+
The target namespace in which the deployment will be deployed is defined via the `coder_workspace`
66
82
variable. The namespace must exist prior to creating workspaces.
`code-server`is installed via the `startup_script` argument in the `coder_agent`
97
113
resource block. The `coder_app` resource is defined to access `code-server` through
98
114
the dashboard UI over `localhost:13337`.
115
+
116
+
## Deployment logs
117
+
118
+
To stream kubernetes pods events from the deployment, you can use Coder's [`coder-logstream-kube`](https://github.com/coder/coder-logstream-kube) tool. This can stream logs from the deployment to Coder's workspace startup logs. You just need to install the `coder-logstream-kube` helm chart on the cluster where the deployment is running.
0 commit comments