6
skywalking的介绍
source link: https://www.cnblogs.com/lori/p/14861645.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Skywalking是一个分布式系统的应用程序性能监视工具,专为微服务、云原生架构和基于容器(Docker、K8s、Mesos)架构而设计。SkyWalking 是观察性分析平台和应用性能管理系统。提供分布式追踪、服务网格遥测分析、度量聚合和可视化一体化解决方案。支持Java, .Net Core, PHP, NodeJS, Golang, LUA语言探针,支持Envoy + Istio构建的Service Mesh。
skywalking四个模块
- skywalking agent和业务系统绑定在一起,负责收集各种监控数据
- skywalking oapservice是负责处理监控数据的,比如接受skywalking agent的监控数据,并存储在数据库中(本案例使用elasticsearch);接受skywalking webapp的前端请求,从数据库查询数据,并返回数据给前端。Skywalking oapservice通常以集群的形式存在。
- skywalking webapp,前端界面,用于展示数据。
- 用于存储监控数据的数据库,比如mysql、elasticsearch等。
模块之间的关系
skywalking部署到k8s
cat > elasticsearch-single.yaml << EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch-single
namespace: efk
labels:
k8s-app: elasticsearch-single
spec:
replicas: 1
selector:
matchLabels:
k8s-app: elasticsearch-single
template:
metadata:
labels:
k8s-app: elasticsearch-single
spec:
containers:
- image: elasticsearch:7.12.0
name: elasticsearch-single
resources:
limits:
cpu: 2
memory: 3Gi
requests:
cpu: 0.5
memory: 500Mi
env:
- name: "discovery.type"
value: "single-node"
- name: ES_JAVA_OPTS
value: "-Xms512m -Xmx2g"
ports:
- containerPort: 9200
name: db
protocol: TCP
volumeMounts:
- name: elasticsearch-data
mountPath: /usr/share/elasticsearch/data
volumes:
- name: elasticsearch-data
persistentVolumeClaim:
claimName: es-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: es-pvc
namespace: efk
spec:
#指定动态PV 名称
storageClassName: "elastic-nfs-client"
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
name: elasticsearch-single
namespace: efk
spec:
ports:
- port: 9200
protocol: TCP
targetPort: 9200
selector:
k8s-app: elasticsearch-single
EOF
kubectl apply -f elasticsearch-single.yaml
安装 helm
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
初始化 skywalking 的 charts 配置
# clone helm 仓库
git clone https://github.com/apache/skywalking-kubernetes
cd skywalking-kubernetes/chart
# 即使使用外部 ES 也要添加这个 repo,否则会导致依赖错误
helm repo add elastic https://helm.elastic.co
helm dep up skywalking
# 创建 skywalking 的 namespace
kubectl create namespace skywalking
配置 skywalking 的 vaules 配置参数
初始化完成后需要自行调整配置文件,配置 oap-server 使用外部 ES,当然你也可以使用 values 自带的 es 的配置示例,这里不做过多介绍
cat > skywalking/values-my-es-01.yaml <<EOF
oap:
image:
tag: 8.4.0-es7
storageType: elasticsearch7
ui:
image:
tag: 8.4.0
service:
type: NodePort
externalPort: 80
internalPort: 8080
nodePort: 30008
elasticsearch:
enabled: false
config:
host: elasticsearch-single.efk
port:
http: 9200
#user: "" # [optional]
#password: "xxx" # [optional]
EOF
5.4 helm 安装 skywalking 8.4.0
helm install skywalking skywalking -n skywalking -f ./skywalking/values-my-es-01.yaml
# 卸载
helm uninstall skywalking -n skywalking
# 查看进度
kubectl get pod -n skywalking -w
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK