Skip to content
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

Cross link for debugging and viewing logs #3919

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: "How to debug the Dapr sidecar (daprd) on your Kubernetes cluster"

Sometimes it is necessary to understand what's going on in the Dapr sidecar (daprd), which runs as a sidecar next to your application, especially when you diagnose your Dapr application and wonder if there's something wrong in Dapr itself. Additionally, you may be developing a new feature for Dapr on Kubernetes and want to debug your code.

his guide will cover how to use built-in Dapr debugging to debug the Dapr sidecar in your Kubernetes pods.
This guide covers how to use built-in Dapr debugging to debug the Dapr sidecar in your Kubernetes pods. To learn how to view logs and troubleshoot Dapr in Kubernetes, see the [Configure and view Dapr logs guide]({{< ref "logs-troubleshooting.md#logs-in-kubernetes-mode" >}})

## Pre-requisites

Expand Down Expand Up @@ -87,6 +87,62 @@ Forwarding from [::1]:40000 -> 40000

All done. Now you can point to port 40000 and start a remote debug session to daprd from your favorite IDE.

## Commonly used `kubectl` commands

Use the following common `kubectl` commands when debugging daprd and applications running on Kubernetes.

Get all pods, events, and services:

```bash
kubectl get all
kubectl get all --n <namespace>
kubectl get all --all-namespaces
```

Get each specifically:

```bash
kubectl get pods
```

```bash
kubectl get events --n <namespace>
kubectl get events --sort-by=.metadata.creationTimestamp --n <namespace>
```

```bash
kubectl get services
```

Check logs:

```bash
kubectl logs <podId> daprd
kubectl logs <podId> <myAppContainerName>
kuebctl logs <deploymentId> daprd
kubectl logs <deploymentId> <myAppContainerName>
```

```bash
kubectl describe pod <podId>
kubectl describe deploy <deployId>
kubectl describe replicaset <replicasetId>
```

Restart a pod by running the following command:

```bash
kubectl delete pod <podId>
```

This causes the `replicaset` controller to restart the pod after the delete.

## Watch the demo

See the presentation on troubleshooting Dapr on Kubernetes in the [Dapr Community Call #36](https://youtu.be/pniLPRbuLD8?si=bGid7oYSp9cThtiI&t=838).

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/pniLPRbuLD8?si=bGid7oYSp9cThtiI&amp;start=838" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

## Related links

- [Overview of Dapr on Kubernetes]({{< ref kubernetes-overview >}})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ dapr run node myapp.js

## Logs in Kubernetes mode

> [Learn how to debug `daprd` on Kubernetes.]({{< ref "debug-daprd.md" >}})

You can set the log level individually for every sidecar by providing the following annotation in your pod spec template:

```yml
Expand Down