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

相关实践学习
通过Ingress进行灰度发布
本场景您将运行一个简单的应用,部署一个新的应用用于新的发布,并通过Ingress能力实现灰度发布。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
相关文章
|
2月前
|
存储 Kubernetes 开发工具
使用ArgoCD管理Kubernetes部署指南
ArgoCD 是一款基于 Kubernetes 的声明式 GitOps 持续交付工具,通过自动同步 Git 存储库中的配置与 Kubernetes 集群状态,确保一致性与可靠性。它支持实时同步、声明式设置、自动修复和丰富的用户界面,极大简化了复杂应用的部署管理。结合 Helm Charts,ArgoCD 提供模块化、可重用的部署流程,显著减少人工开销和配置错误。对于云原生企业,ArgoCD 能优化部署策略,提升效率与安全性,是实现自动化与一致性的理想选择。
102 0
|
20天前
|
存储 Kubernetes 异构计算
Qwen3 大模型在阿里云容器服务上的极简部署教程
通义千问 Qwen3 是 Qwen 系列最新推出的首个混合推理模型,其在代码、数学、通用能力等基准测试中,与 DeepSeek-R1、o1、o3-mini、Grok-3 和 Gemini-2.5-Pro 等顶级模型相比,表现出极具竞争力的结果。
|
2月前
|
存储 Kubernetes 监控
K8s集群实战:使用kubeadm和kuboard部署Kubernetes集群
总之,使用kubeadm和kuboard部署K8s集群就像回归童年一样,简单又有趣。不要忘记,技术是为人服务的,用K8s集群操控云端资源,我们不过是想在复杂的世界找寻简单。尽管部署过程可能遇到困难,但朝着简化复杂的目标,我们就能找到意义和乐趣。希望你也能利用这些工具,找到你的乐趣,满足你的需求。
229 33
|
2月前
|
Kubernetes 开发者 Docker
集群部署:使用Rancher部署Kubernetes集群。
以上就是使用 Rancher 部署 Kubernetes 集群的流程。使用 Rancher 和 Kubernetes,开发者可以受益于灵活性和可扩展性,允许他们在多种环境中运行多种应用,同时利用自动化工具使工作负载更加高效。
111 19
|
2月前
|
存储 测试技术 对象存储
使用容器服务ACK快速部署QwQ-32B模型并实现推理智能路由
阿里云最新发布的QwQ-32B模型,通过强化学习大幅度提升了模型推理能力。QwQ-32B模型拥有320亿参数,其性能可以与DeepSeek-R1 671B媲美。
|
3月前
|
存储 Kubernetes 测试技术
企业级LLM推理部署新范式:基于ACK的DeepSeek蒸馏模型生产环境落地指南
企业级LLM推理部署新范式:基于ACK的DeepSeek蒸馏模型生产环境落地指南
146 12
|
3月前
|
人工智能 Kubernetes 异构计算
大道至简-基于ACK的Deepseek满血版分布式推理部署实战
大道至简-基于ACK的Deepseek满血版分布式推理部署实战
160 5
|
3月前
|
存储 Kubernetes 对象存储
部署DeepSeek但GPU不足,ACK One注册集群助力解决IDC GPU资源不足
部署DeepSeek但GPU不足,ACK One注册集群助力解决IDC GPU资源不足
|
3月前
|
边缘计算 调度 对象存储
部署DeepSeek但IDC GPU不足,阿里云ACK Edge虚拟节点来帮忙
部署DeepSeek但IDC GPU不足,阿里云ACK Edge虚拟节点来帮忙
|
3月前
|
存储 Kubernetes 对象存储
部署 DeepSeek 但 GPU 不足,ACK One 注册集群助力解决 IDC GPU 资源不足
部署 DeepSeek 但 GPU 不足,ACK One 注册集群助力解决 IDC GPU 资源不足

热门文章

最新文章