前置条件
依赖配置
域名配置
address=/skywalking-oap.basic.tanqidi.com/172.31.0.100
address=/skywalking.dev.tanqidi.com/172.31.0.100
1. docker 部署
docker run -d --name skywalking-oap \
-e TZ=Asia/Shanghai \
-e SW_STORAGE=elasticsearch \
-e SW_STORAGE_ES_CLUSTER_NODES=elasticsearch1.basic.tanqidi.com:9200 \
-p 12800:12800 \
-p 11800:11800 \
--restart=always \
apache/skywalking-oap-server:9.7.0
# 8080端口太常见了,在docker部署容易冲突,我就用8001代替
docker run -d --name skywalking-ui \
-e TZ=Asia/Shanghai \
-p 8001:8080 \
-e SW_OAP_ADDRESS=http://skywalking-oap.basic.tanqidi.com:12800 \
--restart=always \
apache/skywalking-ui:9.7.0
2. kubernetes 部署
2.1 skywalking-oap
2.1.1 deployment
kind: Deployment
apiVersion: apps/v1
metadata:
name: skywalking-oap
namespace: basic
labels:
app: skywalking-oap
annotations:
deployment.kubernetes.io/revision: '1'
kubesphere.io/creator: admin
spec:
replicas: 1
selector:
matchLabels:
app: skywalking-oap
template:
metadata:
creationTimestamp: null
labels:
app: skywalking-oap
annotations:
kubesphere.io/creator: admin
kubesphere.io/imagepullsecrets: '{}'
spec:
volumes:
- name: host-time
hostPath:
path: /etc/localtime
type: ''
containers:
- name: skywalking-oap
image: 'apache/skywalking-oap-server:9.7.0'
ports:
- name: http-12800
containerPort: 12800
protocol: TCP
- name: http-11800
containerPort: 11800
protocol: TCP
env:
- name: TZ
value: Asia/Shanghai
- name: SW_STORAGE
value: elasticsearch
- name: SW_STORAGE_ES_CLUSTER_NODES
value: 'elasticsearch.basic.svc.cluster.local:9200'
resources: {}
volumeMounts:
- name: host-time
readOnly: true
mountPath: /etc/localtime
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccountName: default
serviceAccount: default
securityContext: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
2.1.2 service
使用了NodePort来测试访问
kind: Service
apiVersion: v1
metadata:
name: skywalking-oap
namespace: basic
labels:
app: skywalking-oap
annotations:
kubesphere.io/creator: admin
spec:
ports:
- name: http-12800
protocol: TCP
port: 12800
targetPort: 12800
nodePort: 31346
- name: http-11800
protocol: TCP
port: 11800
targetPort: 11800
nodePort: 31347
selector:
app: skywalking-oap
type: NodePort
sessionAffinity: None
externalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
2.1.3 coredns
rewrite name skywalking-oap.basic.tanqidi.com skywalking-oap.basic.svc.cluster.local
2.2 skywalking-ui
2.2.1 deployment
kind: Deployment
apiVersion: apps/v1
metadata:
name: skywalking-ui
namespace: basic
labels:
app: skywalking-ui
annotations:
deployment.kubernetes.io/revision: '1'
kubesphere.io/creator: admin
spec:
replicas: 1
selector:
matchLabels:
app: skywalking-ui
template:
metadata:
creationTimestamp: null
labels:
app: skywalking-ui
annotations:
kubesphere.io/creator: admin
kubesphere.io/imagepullsecrets: '{}'
spec:
volumes:
- name: host-time
hostPath:
path: /etc/localtime
type: ''
containers:
- name: skywalking-ui
image: 'apache/skywalking-ui:9.7.0'
ports:
- name: http-8080
containerPort: 8080
protocol: TCP
env:
- name: TZ
value: Asia/Shanghai
- name: SW_OAP_ADDRESS
value: 'http://skywalking-oap.basic.svc.cluster.local:12800'
resources: {}
volumeMounts:
- name: host-time
readOnly: true
mountPath: /etc/localtime
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccountName: default
serviceAccount: default
securityContext: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
2.2.2 service
使用了NodePort来测试访问
kind: Service
apiVersion: v1
metadata:
name: skywalking-ui
namespace: basic
labels:
app: skywalking-ui
annotations:
kubesphere.io/creator: admin
spec:
ports:
- name: http-8080
protocol: TCP
port: 8080
targetPort: 8080
nodePort: 31942
selector:
app: skywalking-ui
type: NodePort
sessionAffinity: None
externalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster