概述
k8s
离线安装安装 skywalking9.4
版本,环境:k8s版本为:1.27.x 、spring boot 2.7.x spring cloud :2021.0.5 、spring.cloud.alibab:2021.0.4.0 、jkd: 1.8
完整的整合视频测试:k8s整合gitlab使用芋道做微服务的cicd
- 探针 基于不同的来源可能是不一样的, 但作用都是收集数据, 将数据格式化为 SkyWalking 适用的格式.
- 平台后端, 支持数据聚合,
数据分析
以及驱动数据流从探针到用户界面的流程。分析包括 Skywalking 原生追踪和性能指标以及第三方来源,包括 Istio 及 Envoy telemetry , Zipkin 追踪格式化等。 你甚至可以使用Observability Analysis Language
对原生度量指标 和用于扩展度量的计量系统
自定义聚合分析。 - 存储 通过开放的插件化的接口存放 SkyWalking 数据. 你可以选择一个既有的存储系统, 如 ElasticSearch, H2 或 MySQL 集群(Sharding-Sphere 管理),也可以选择自己实现一个存储系统. 当然, 我们非常欢迎你贡献新的存储系统实现。
- UI 一个基于接口高度定制化的Web系统,用户可以可视化查看和管理 SkyWalking 数据。
资源下载
镜像可以自己准备,懒人速递:skywalking-oap-server-9.4离线镜像可安装版本 skywalking-ui-9.4离线镜像安装版本 busybox镜像离线安装包stable-musl版本
Skywalking功能介绍
- 多种监控手段,可以通过语言探针和service mesh获得监控的数据
- 支持多重语言的自动探针,包括JAVA, .NET Core和NodeJS
- 轻量高效,无需大数据平台和大量的服务器资源
- 模块化,UI ,存储,集群管理都有多种机制可选
- 支持告警
- 优秀的可视化解决方案
成果速览
9.4版本的功能还是很强大的,如下图所示。
实践
rbac
# vim rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: skywalking
name: skywalking-oap
namespace: default
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: skywalking
namespace: default
labels:
app: skywalking
rules:
- apiGroups: [""]
resources: ["pods", "endpoints", "services", "nodes"]
verbs: ["get", "watch", "list"]
- apiGroups: ["extensions"]
resources: ["deployments", "replicasets"]
verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: skywalking
namespace: default
labels:
app: skywalking
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: skywalking
subjects:
- kind: ServiceAccount
name: skywalking-oap
namespace: default
oap
# vim dp.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: oap
name: oap
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: oap
template:
metadata:
labels:
app: oap
spec:
serviceAccountName: skywalking-oap
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: app1
# operator: In
# values:
# - skywalking
# initContainers:
# - name: wait-for-elasticsearch
# image: harbor.easzlab.io.local:8443/library/busybox:stable-musl
# imagePullPolicy: IfNotPresent
# command: ['sh', '-c', 'for i in $(seq 1 60); do nc -z -w3 elasticsearch.default.svc.cluster.local 9200 && exit 0 || sleep 5; done; exit 1']
containers:
- name: oap
image: harbor.easzlab.io.local:8443/library/skywalking-oap-server:9.4.0
imagePullPolicy: IfNotPresent
livenessProbe:
tcpSocket:
port: 12800
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
tcpSocket:
port: 12800
initialDelaySeconds: 15
periodSeconds: 20
ports:
- containerPort: 11800
name: grpc
- containerPort: 1234
name: prometheus-port
- containerPort: 12800
name: rest
env:
- name: JAVA_OPTS
value: "-Dmode=init-only -Xmx2g -Xms2g"
- name: TZ # 设置时区
value: Asia/Shanghai
- name: SW_OTEL_RECEIVER
value: "default"
- name: SW_ENABLE_UPDATE_UI_TEMPLATE # 开启试图可编辑,默认为:false
value: "true"
- name: SW_CLUSTER
value: kubernetes
- name: SW_CLUSTER_K8S_NAMESPACE
value: "default"
- name: SW_CLUSTER_K8S_LABEL
value: "app=oap"
- name: SKYWALKING_COLLECTOR_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: SW_STORAGE # 使用es作为存储
value: elasticsearch
- name: SW_STORAGE_ES_CLUSTER_NODES # es地址
value: "elasticsearch.default.svc.cluster.local:9200"
# - name: SW_ES_USER # es用户
# value: "elastic"
# - name: SW_ES_PASSWORD # es密码
# value: "admin123"
- name: SW_TELEMETRY
value: "prometheus"
oap-svc
apiVersion: v1
kind: Service
metadata:
name: oap-svc
namespace: default
labels:
app: oap
spec:
type: ClusterIP
ports:
- port: 11800
name: grpc
- port: 1234
name: prometheus-port
- port: 12800
name: rest
selector:
app: oap
ui
# vim ui-dp.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ui
namespace: default
labels:
app: ui
spec:
replicas: 1
selector:
matchLabels:
app: ui
template:
metadata:
labels:
app: ui
spec:
# affinity:
containers:
- name: ui
image: harbor.easzlab.io.local:8443/library/skywalking-ui:9.4.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
name: page
env:
- name: SW_OAP_ADDRESS
value: http://oap-svc:12800 # 根据oap的svc一致
ui-svc
# vim ui-svc.yaml
---
apiVersion: v1
kind: Service
metadata:
labels:
app: ui
name: ui-svc
namespace: default
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8080
protocol: TCP
selector:
app: ui
结束
k8s离线安装安装skywalking9.4总结。