zoukankan      html  css  js  c++  java
  • skywalking 组件关系及部署

    一,组件关系

    1,skywalking由三个部分组成

    1, skywalking-oap      从agent或es等数据源获取数据
    2, skywalking-ui       从skywalking-oap获取数据,并展示到web页面
    3, skywalking-agent    从微服务获取数据并写入到配置的数据源中,如es,nacos等
    

    2,配置关系

    1, skywalking-oap 有两个端口暴露
    2, 11800 : grpc协议  用于agent上传数据
    3, 12800:  rset协议  用于与skywalking-ui通信,skywalking-ui配置SW_OAP_ADDRESS时 要注意填写12800端口
    

    二,部署skywalking

    1,部署skywalking-oap

    1.1创建configmap

    点击查看代码
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: skywalking-cm
    data:
      CLUSTER: 'nacos'
      CLUSTER_NACOS_HOST_PORT: 'nacos-headless:8848'
      STORAGE: 'elasticsearch7'
      STORAGE_ES_CLUSTER_NODES: 'IP:PORT'
      ES_USER: '用户名'
      ES_PASSWORD: '密码'
      CORE_GRPC_PORT: '11800'
      CORE_REST_PORT: '12800'
    

    1.2部署deployment

    点击查看代码
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      labels:
        app: skywalking
      name: skywalking
      namespace: default
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: skywalking
      template:
        metadata:
          labels:
            app: skywalking
        spec:
          containers:
            - envFrom:
              - prefix: SW_
                configMapRef: 
                  name: skywalking-cm                  
              image: apache/skywalking-oap-server:8.5.0-es7
              imagePullPolicy: IfNotPresent         
              name: skywalking
              ports:
                - containerPort: 12800
                  name: http
                  protocol: TCP
                - containerPort: 11800
                  name: grpc
                  protocol: TCP
              resources:
                limits:
                  cpu: '2'
                  memory: 2Gi
                requests:
                  cpu: '1'
                  memory: 2Gi
              volumeMounts:
                - mountPath: /etc/localtime
                  name: volume-localtime
          volumes:
            - hostPath:
                path: /etc/localtime
                type: ''
              name: volume-localtime
    

    1.3部署service

    点击查看代码
    apiVersion: v1
    kind: Service
    metadata:
      name: skywalking
      labels:
        app: skywalking
    spec:
      type: ClusterIP
      ports:
        - name: http
          port: 12800
          protocol: TCP
          targetPort: 12800
        - name: grpc
          port: 11800
          protocol: TCP
          targetPort: 11800
      selector:
        app: skywalking
    

    2,部署skywalking-ui

    2.1 部署deployment

    点击查看代码
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      labels:
        app: skywalking-ui
      name: skywalking-ui
      namespace: default
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: skywalking-ui
      template:
        metadata:
          labels:
            app: skywalking-ui
        spec:
          containers:
            - env:
                - name: SW_OAP_ADDRESS
                  value: "skywalking:12800"          
              image: apache/skywalking-ui:8.5.0
              imagePullPolicy: IfNotPresent         
              name: skywalking-ui
              ports:
                - containerPort: 8080
                  name: http
                  protocol: TCP
              resources:
                limits:
                  cpu: '2'
                  memory: 1Gi
                requests:
                  cpu: '1'
                  memory: 1Gi
              volumeMounts:
                - mountPath: /etc/localtime
                  name: volume-localtime
          volumes:
            - hostPath:
                path: /etc/localtime
                type: ''
              name: volume-localtime
    

    2.2 部署service

    点击查看代码
    apiVersion: v1
    kind: Service
    metadata:
      name: skywalking-ui
      labels:
        app: skywalking-ui
    spec:
      type: ClusterIP
      ports:
        - name: http
          port: 8080
          protocol: TCP
          targetPort: 8080
      selector:
        app: skywalking-ui
    

    3,部署agent

    部署agent有多种方式,简单介绍两中

    1.1 将agent.jar与程序打包在同一镜像中:实现简单

    点击查看代码
    FROM 基础镜像
    
    ADD skagent /skagent
    ADD agent.jar /agent.jar
    ENTRYPOINT ["java", "-javaagent:/agent/skywalking-agent.jar", "-jar", "-server", "/app.jar"]
    

    1.2 rancher中 直接将agent.jar复制到系统应用的家目录中,入口命令添加启动即可

    agent配置优先级
    优先级:探针 > JVM配置 > 系统环境变量 > agent.config
    启动命令参考
    -javaagent:/path/to/skywalking-agent.jar={config1}={value1},{config2}={value2}
    Java -javaagent:../skywalking-agent.jar=agent.service_name=service-name -jar XXX.jar

  • 相关阅读:
    LaTeX表格紧跟文字 (不影响下方文本对齐)
    latex减少图片和图片解释文字之间的距离、调整公式与正文间距离,调整空白大小:
    请收藏,Linux 运维必备的 40 个命令总结,收好了~
    将公式直接转化为Latex代码的神器-Mathpix Snip
    if __name__ == '__main__':的作用和原理【转】
    PyCharm,Terminal 常用快捷键
    Python包中 __init__.py文件的作用
    pycharm写代码光标变成了黑框
    客户端链接Blog
    Sublime 中文标题乱码
  • 原文地址:https://www.cnblogs.com/peng-zone/p/15628352.html
Copyright © 2011-2022 走看看