Dapr进阶-01-Debug dapr

2023-12-09 21:38
文章标签 debug 进阶 01 dapr

本文主要是介绍Dapr进阶-01-Debug dapr,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1. 安装golang

CentOS 8 安装golang_敦格-CSDN博客CentOS 8 安装golanghttps://shuaihj.blog.csdn.net/article/details/123018041

2. 以debug模式编译源码

Debug daprd on Kubernetes | Dapr DocsHow to debug the Dapr sidecar (daprd) on your Kubernetes clusterhttps://docs.dapr.io/developing-applications/debugging/debug-k8s/debug-daprd/

2.1. 下载dapr源码

git clone https://github.com/dapr/dapr.git

2.2. 目录定位

cd dapr

2.3. 修改Dockerfile中的GOPROXY为国内镜像源

vi ./docker/Dockerfile-debug
  • 关键参数如下 
GOPROXY=https://goproxy.cn,direct
  • 结果 

2.4. 编译

make release GOOS=linux GOARCH=amd64 DEBUG=1

3. 生成debug模式的dapr镜像到你自己的docker库

3.1. 登录你的docker hub

docker login

3.2. 提前下载gcr.io的docker镜像

gcr.io/distroless/static:nonroot

国内无法访问gcr.io的解决办法_敦格-CSDN博客国内无法访问gcr.io的解决办法https://shuaihj.blog.csdn.net/article/details/123022325

3.3. 验证本地docker镜像

docker images | grep static

3.4. Build 并 Push到docker hub

export DAPR_TAG=dev
export DAPR_REGISTRY=k8schina
make docker-push DEBUG=1

3.5. 验证docker hub

4. 安装debug模式的的dapr

4.1. 创建values.yaml文件

vi values.yaml
global:registry: docker.io/k8schinatag: "dev-linux-amd64"logAsJson: true
dapr_operator:debug:enabled: true
dapr_sidecar_injector:hostNetwork: truedebug:enabled: true
dapr_placement:debug:enabled: true
dapr_sentry:debug:enabled: true

4.2. 卸载旧版本

helm uninstall dapr --namespace dapr-system

4.3. 安装debug版本

  • 必须 进入dapr源码目录
cd dapr
  • 自定义安装 
helm install dapr charts/dapr \
--namespace dapr-system \
--create-namespace \
--values values.yaml \
--wait

4.4. 验证

docker images | grep dev

5. Debug Dapr 控制面组件

5.1. 查看要debug的控制面pod

kubectl get pods -n dapr-system -o wide

5.2. debug监控你的控制面pod

kubectl port-forward dapr-operator-7878f94fcd-6bfx9 40000:40000 -n dapr-system

6. Debug 微服务的 daprd sidecar

Debug daprd on Kubernetes | Dapr DocsHow to debug the Dapr sidecar (daprd) on your Kubernetes clusterhttps://docs.dapr.io/developing-applications/debugging/debug-k8s/debug-daprd/

6.1. 配置你的deployment为可debug

dapr.io/enable-debug: "true"
apiVersion: v1
kind: Namespace
metadata:name: dapr-demo
---
apiVersion: apps/v1
kind: Deployment
metadata:name: service01namespace: dapr-demolabels:app: service01
spec:replicas: 2selector:matchLabels:app: service01template:metadata:labels:app: service01annotations:dapr.io/enabled: "true"dapr.io/app-id: "service01"dapr.io/app-port: "80"dapr.io/sidecar-liveness-probe-delay-seconds: "10"dapr.io/sidecar-readiness-probe-delay-seconds: "10"dapr.io/log-as-json: "true"dapr.io/enable-debug: "true"spec:containers:- name: service01image: docker.io/k8schina/service01:v1ports:- containerPort: 80imagePullPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:name: service02namespace: dapr-demolabels:app: service02
spec:replicas: 1selector:matchLabels:app: service02template:metadata:labels:app: service02annotations:dapr.io/enabled: "true"dapr.io/app-id: "service02"dapr.io/app-port: "80"dapr.io/sidecar-liveness-probe-delay-seconds: "10"dapr.io/sidecar-readiness-probe-delay-seconds: "10"dapr.io/log-as-json: "true"dapr.io/enable-debug: "true"spec:containers:- name: service02image: docker.io/k8schina/service02:v1ports:- containerPort: 80imagePullPolicy: Always
---
apiVersion: v1
kind: Service
metadata:name: service02namespace: dapr-demo
spec:type: NodePortselector:app: service02ports:- port: 80targetPort: 80nodePort: 30006

6.2. 部署你的微服务

kubectl apply -f http://k8schina.corecore.cn/DaprDemo.yaml

6.3. 查看要debug的微服务pod

kubectl get pods -n dapr-demo -o wide

6.4. debug监控你的目标pod

kubectl port-forward dapr-operator-7878f94fcd-6bfx9 40000:40000 -n dapr-demo

这篇关于Dapr进阶-01-Debug dapr的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/475153

相关文章

Spring Security 从入门到进阶系列教程

Spring Security 入门系列 《保护 Web 应用的安全》 《Spring-Security-入门(一):登录与退出》 《Spring-Security-入门(二):基于数据库验证》 《Spring-Security-入门(三):密码加密》 《Spring-Security-入门(四):自定义-Filter》 《Spring-Security-入门(五):在 Sprin

Java进阶13讲__第12讲_1/2

多线程、线程池 1.  线程概念 1.1  什么是线程 1.2  线程的好处 2.   创建线程的三种方式 注意事项 2.1  继承Thread类 2.1.1 认识  2.1.2  编码实现  package cn.hdc.oop10.Thread;import org.slf4j.Logger;import org.slf4j.LoggerFactory

hdu 2602 and poj 3624(01背包)

01背包的模板题。 hdu2602代码: #include<stdio.h>#include<string.h>const int MaxN = 1001;int max(int a, int b){return a > b ? a : b;}int w[MaxN];int v[MaxN];int dp[MaxN];int main(){int T;int N, V;s

[MySQL表的增删改查-进阶]

🌈个人主页:努力学编程’ ⛅个人推荐: c语言从初阶到进阶 JavaEE详解 数据结构 ⚡学好数据结构,刷题刻不容缓:点击一起刷题 🌙心灵鸡汤:总有人要赢,为什么不能是我呢 💻💻💻数据库约束 🔭🔭🔭约束类型 not null: 指示某列不能存储 NULL 值unique: 保证某列的每行必须有唯一的值default: 规定没有给列赋值时的默认值.primary key:

【Linux 从基础到进阶】Ansible自动化运维工具使用

Ansible自动化运维工具使用 Ansible 是一款开源的自动化运维工具,采用无代理架构(agentless),基于 SSH 连接进行管理,具有简单易用、灵活强大、可扩展性高等特点。它广泛用于服务器管理、应用部署、配置管理等任务。本文将介绍 Ansible 的安装、基本使用方法及一些实际运维场景中的应用,旨在帮助运维人员快速上手并熟练运用 Ansible。 1. Ansible的核心概念

Flutter 进阶:绘制加载动画

绘制加载动画:由小圆组成的大圆 1. 定义 LoadingScreen 类2. 实现 _LoadingScreenState 类3. 定义 LoadingPainter 类4. 总结 实现加载动画 我们需要定义两个类:LoadingScreen 和 LoadingPainter。LoadingScreen 负责控制动画的状态,而 LoadingPainter 则负责绘制动画。

从0到1,AI我来了- (7)AI应用-ComfyUI-II(进阶)

上篇comfyUI 入门 ,了解了TA是个啥,这篇,我们通过ComfyUI 及其相关Lora 模型,生成一些更惊艳的图片。这篇主要了解这些内容:         1、哪里获取模型?         2、实践如何画一个美女?         3、附录:               1)相关SD(稳定扩散模型的组成部分)               2)模型放置目录(重要)

java学习,进阶,提升

http://how2j.cn/k/hutool/hutool-brief/1930.html?p=73689

集中式版本控制与分布式版本控制——Git 学习笔记01

什么是版本控制 如果你用 Microsoft Word 写过东西,那你八成会有这样的经历: 想删除一段文字,又怕将来这段文字有用,怎么办呢?有一个办法,先把当前文件“另存为”一个文件,然后继续改,改到某个程度,再“另存为”一个文件。就这样改着、存着……最后你的 Word 文档变成了这样: 过了几天,你想找回被删除的文字,但是已经记不清保存在哪个文件了,只能挨个去找。真麻烦,眼睛都花了。看

【408DS算法题】039进阶-判断图中路径是否存在

Index 题目分析实现总结 题目 对于给定的图G,设计函数实现判断G中是否含有从start结点到stop结点的路径。 分析实现 对于图的路径的存在性判断,有两种做法:(本文的实现均基于邻接矩阵存储方式的图) 1.图的BFS BFS的思路相对比较直观——从起始结点出发进行层次遍历,遍历过程中遇到结点i就表示存在路径start->i,故只需判断每个结点i是否就是stop