skywalking使用ES做存储在K8S上的部署,使用实践_skywalking sw_storage_es_cluster_nodes
在Kubernetes环境中部署SkyWalking并使用Elasticsearch作为存储后端的步骤如下:
- 创建Elasticsearch服务。
- 创建SkyWalking OAP服务。
- 创建SkyWalking UI服务。
以下是一个简化版的YAML配置文件示例,用于在Kubernetes中部署SkyWalking,并配置Elasticsearch作为存储后端。
# Elasticsearch Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.0
ports:
- containerPort: 9200
- containerPort: 9300
env:
- name: discovery.type
value: single-node
# SkyWalking OAP Service
apiVersion: v1
kind: Service
metadata:
name: skywalking-oap-service
spec:
selector:
app: skywalking-oap
ports:
- protocol: TCP
port: 11800
targetPort: 11800
# SkyWalking UI Service
apiVersion: v1
kind: Service
metadata:
name: skywalking-ui-service
spec:
type: NodePort
selector:
app: skywalking-ui
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30001
# SkyWalking OAP Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: skywalking-oap
spec:
replicas: 1
selector:
matchLabels:
app: skywalking-oap
template:
metadata:
labels:
app: skywalking-oap
spec:
containers:
- name: skywalking-oap
image: apache/skywalking-oap-server:8.9.0
ports:
- containerPort: 11800
env:
- name: SW_STORAGE
value: elasticsearch
- name: SW_STORAGE_ES_CLUSTER_NODES
value: elasticsearch:9200
# SkyWalking UI Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: skywalking-ui
spec:
replicas: 1
selector:
matchLabels:
app: skywalking-ui
template:
metadata:
labels:
app: skywalking-ui
spec:
containers:
- name: skywalking-ui
image: apache/skywalking-ui:8.9.0
ports:
- containerPort: 80
env:
- name: SW_OAP_ADDRESS
value: skywalking-oap-service:11800
在这个配置中,Elasticsearch作为后端存储被用于SkyWalking。请确保Elasticsearch服务可被SkyWalking OAP服务访问,并且在SW_STORAGE_ES_CLUSTER_NODES
环境变量中正确配置了Elasticsearch节点地址。
部署这些资源到Kubernetes集群中,并通过对应的服务访问
评论已关闭