k8s部署grafana beyla实现app应用服务依赖图可观测

本文涉及的产品
可观测可视化 Grafana 版,10个用户账号 1个月
简介: k8s部署grafana beyla实现app应用服务依赖图可观测

k8s部署grafana beyla
OS:
Static hostname: test
Icon name: computer-vm
Chassis: vm
Machine ID: 22349ac6f9ba406293d0541bcba7c05d
Boot ID: 83bb7e5dbf27453c94ff9f1fe88d5f02
Virtualization: vmware
Operating System: Ubuntu 22.04.4 LTS
Kernel: Linux 5.15.0-105-generic
Architecture: x86-64
Hardware Vendor: VMware, Inc.
Hardware Model: VMware Virtual Platform

kubespray version:
2.25.0

kubernetes version:
1.29.5

部署测试用nginx
cat > nginx.yaml <<EOF
kind: Deployment
apiVersion: apps/v1
metadata:
name: docs
spec:
replicas: 2
selector:
matchLabels:
app: docs
template:
metadata:
labels:
app: docs
spec:
containers:

    - name: docs-server
      image: httpd:latest
      ports:
        - containerPort: 80
          protocol: TCP
          name: http

apiVersion: v1
kind: Service
metadata:
name: docs
spec:
selector:
app: docs
ports:

- protocol: TCP
  port: 80

kind: Deployment
apiVersion: apps/v1
metadata:
name: website
spec:
replicas: 2
selector:
matchLabels:
app: website
template:
metadata:
labels:
app: website
spec:
containers:

    - name: website-server
      image: dockerhub.timeweb.cloud/httpd:latest
      ports:
        - containerPort: 80
          protocol: TCP
          name: http

apiVersion: v1
kind: Service
metadata:
name: website
spec:
selector:
app: website
ports:

- protocol: TCP
  port: 80

EOF

创建

kubectl apply -f nginx.yaml

转发端口

kubectl port-forward services/website 8080:80
kubectl port-forward services/docs 8081:80

部署grafana beyla

创建命名空间

kubectl create namespace beyla

创建serviceaccount

cat > beyla-serviceaccount.yaml <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: beyla

name: beyla

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: beyla
rules:

  • apiGroups: ["apps"]
    resources: ["replicasets"]
    verbs: ["list", "watch"]
  • apiGroups: [""]
    resources: ["pods"]
    verbs: ["list", "watch"]

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: beyla
subjects:

  • kind: ServiceAccount
    name: beyla
    namespace: beyla
    roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: ClusterRole
    name: beyla
    EOF

kubectl apply -f beyla-serviceaccount.yaml

cat > beyla.yaml <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
namespace: beyla
name: beyla-config
data:
beyla-config.yml: |

# this is required to enable kubernetes discovery and metadata
attributes:
  kubernetes:
    enable: true
# this will provide automatic routes report while minimizing cardinality
routes:
  unmatched: heuristic
# let's instrument only the docs server
discovery:
  services:
    - k8s_deployment_name: "^docs$"
    # uncomment the following line to also instrument the website server
    # - k8s_deployment_name: "^website$"

apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: beyla
name: beyla
spec:
selector:
matchLabels:
instrumentation: beyla
template:
metadata:
labels:
instrumentation: beyla
spec:
serviceAccountName: beyla
hostPID: true # mandatory!
containers:

    - name: beyla
      image: dockerhub.timeweb.cloud/grafana/beyla:1.2
      imagePullPolicy: IfNotPresent
      securityContext:
        privileged: true # mandatory!
        readOnlyRootFilesystem: true
      volumeMounts:
        - mountPath: /config
          name: beyla-config
        - mountPath: /var/run/beyla
          name: var-run-beyla
      env:
        - name: BEYLA_CONFIG_PATH
          value: "/config/beyla-config.yml"
        - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
          value: "http://10.1.1.71:4318/v1/traces"
        - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
          value: "http/protobuf"

- name: OTEL_EXPORTER_OTLP_HEADERS

valueFrom:

secretKeyRef:

name: grafana-credentials

key: otlp-headers

  volumes:
    - name: beyla-config
      configMap:
        name: beyla-config
    - name: var-run-beyla
      emptyDir: {}

EOF

kubectl apply -f beyla.yaml

安装grafana
apt-get install -y adduser libfontconfig1 musl
wget https://dl.grafana.com/oss/release/grafana_10.4.2_amd64.deb
dpkg -i grafana_10.4.2_amd64.deb
systemctl start grafana-server
systemctl enable grafana-server

相关实践学习
深入解析Docker容器化技术
Docker是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化,容器是完全使用沙箱机制,相互之间不会有任何接口。Docker是世界领先的软件容器平台。开发人员利用Docker可以消除协作编码时“在我的机器上可正常工作”的问题。运维人员利用Docker可以在隔离容器中并行运行和管理应用,获得更好的计算密度。企业利用Docker可以构建敏捷的软件交付管道,以更快的速度、更高的安全性和可靠的信誉为Linux和Windows Server应用发布新功能。 在本套课程中,我们将全面的讲解Docker技术栈,从环境安装到容器、镜像操作以及生产环境如何部署开发的微服务应用。本课程由黑马程序员提供。 &nbsp; &nbsp; 相关的阿里云产品:容器服务 ACK 容器服务 Kubernetes 版(简称 ACK)提供高性能可伸缩的容器应用管理能力,支持企业级容器化应用的全生命周期管理。整合阿里云虚拟化、存储、网络和安全能力,打造云端最佳容器化应用运行环境。 了解产品详情: https://www.aliyun.com/product/kubernetes
相关文章
|
2月前
|
数据采集 弹性计算 运维
打造您的专属赛事神经中枢 | 专业比分网/APP开发服务
我们为体育俱乐部、媒体、社区等打造专属实时比分平台,覆盖全球赛事,支持多终端访问,提供毫秒级更新、精准数据与个性化推送,助力高效观赛体验。
|
6月前
|
存储 Kubernetes 开发工具
使用ArgoCD管理Kubernetes部署指南
ArgoCD 是一款基于 Kubernetes 的声明式 GitOps 持续交付工具,通过自动同步 Git 存储库中的配置与 Kubernetes 集群状态,确保一致性与可靠性。它支持实时同步、声明式设置、自动修复和丰富的用户界面,极大简化了复杂应用的部署管理。结合 Helm Charts,ArgoCD 提供模块化、可重用的部署流程,显著减少人工开销和配置错误。对于云原生企业,ArgoCD 能优化部署策略,提升效率与安全性,是实现自动化与一致性的理想选择。
300 0
|
5月前
|
存储 Kubernetes 异构计算
Qwen3 大模型在阿里云容器服务上的极简部署教程
通义千问 Qwen3 是 Qwen 系列最新推出的首个混合推理模型,其在代码、数学、通用能力等基准测试中,与 DeepSeek-R1、o1、o3-mini、Grok-3 和 Gemini-2.5-Pro 等顶级模型相比,表现出极具竞争力的结果。
|
6月前
|
存储 Kubernetes 监控
K8s集群实战:使用kubeadm和kuboard部署Kubernetes集群
总之,使用kubeadm和kuboard部署K8s集群就像回归童年一样,简单又有趣。不要忘记,技术是为人服务的,用K8s集群操控云端资源,我们不过是想在复杂的世界找寻简单。尽管部署过程可能遇到困难,但朝着简化复杂的目标,我们就能找到意义和乐趣。希望你也能利用这些工具,找到你的乐趣,满足你的需求。
607 33
|
6月前
|
Kubernetes 开发者 Docker
集群部署:使用Rancher部署Kubernetes集群。
以上就是使用 Rancher 部署 Kubernetes 集群的流程。使用 Rancher 和 Kubernetes,开发者可以受益于灵活性和可扩展性,允许他们在多种环境中运行多种应用,同时利用自动化工具使工作负载更加高效。
341 19
|
6月前
|
存储 测试技术 对象存储
使用容器服务ACK快速部署QwQ-32B模型并实现推理智能路由
阿里云最新发布的QwQ-32B模型,通过强化学习大幅度提升了模型推理能力。QwQ-32B模型拥有320亿参数,其性能可以与DeepSeek-R1 671B媲美。
|
7月前
|
存储 Kubernetes 测试技术
企业级LLM推理部署新范式:基于ACK的DeepSeek蒸馏模型生产环境落地指南
企业级LLM推理部署新范式:基于ACK的DeepSeek蒸馏模型生产环境落地指南
295 12
|
7月前
|
人工智能 Kubernetes 异构计算
大道至简-基于ACK的Deepseek满血版分布式推理部署实战
大道至简-基于ACK的Deepseek满血版分布式推理部署实战
378 5
|
7月前
|
存储 Kubernetes 对象存储
部署DeepSeek但GPU不足,ACK One注册集群助力解决IDC GPU资源不足
部署DeepSeek但GPU不足,ACK One注册集群助力解决IDC GPU资源不足
167 3
|
7月前
|
边缘计算 调度 对象存储
部署DeepSeek但IDC GPU不足,阿里云ACK Edge虚拟节点来帮忙
部署DeepSeek但IDC GPU不足,阿里云ACK Edge虚拟节点来帮忙
123 0

热门文章

最新文章

推荐镜像

更多