skywalking-ui部署:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: skywalking
    component: ui
    release: skywalking
  name: skywalking-ui
  namespace: default
spec:
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: skywalking
      component: ui
      release: skywalking
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: skywalking
        component: ui
        release: skywalking
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app: skywalking
                    component: ui
                    release: skywalking
                topologyKey: kubernetes.io/hostname
              weight: 1
      containers:
        - env:
            - name: SW_OAP_ADDRESS
              value: 'http://skywalking-oap:12800'
          image: 'apache/skywalking-ui:8.8.1'
          imagePullPolicy: IfNotPresent
          name: ui
          ports:
            - containerPort: 8080
              name: page
              protocol: TCP
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      terminationGracePeriodSeconds: 30

ui-service部署

apiVersion: v1
kind: Service
metadata:
  labels:
    app: skywalking
    component: ui
    release: skywalking
  name: skywalking-ui
  namespace: default
spec:
  type: ClusterIP
  ports:
    - name: rest
      port: 80
      protocol: TCP
      targetPort: 8080
  selector:
    app: skywalking
    component: ui
    release: skywalking

skywalking服务部署

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: skywalking
    component: oap
    release: skywalking
  name: skywalking-oap
  namespace: default
spec:
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: skywalking
      component: oap
      release: skywalking
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: skywalking
        component: oap
        release: skywalking
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app: skywalking
                    component: oap
                    release: skywalking
                topologyKey: kubernetes.io/hostname
              weight: 1
      containers:
        - env:
            - name: JAVA_OPTS
              value: '-Xmx2g -Xms2g'
            - name: SW_CLUSTER_K8S_NAMESPACE
              value: default
            - name: SW_STORAGE
              value: elasticsearch
            - name: SW_STORAGE_ES_CLUSTER_NODES
              value: '10.157.4.100:9200,10.157.4.101:9200,10.157.4.102:9200'
            - name: SW_ES_USER
              value: ''
            - name: SW_ES_PASSWORD
              value: ''
            - name: SW_CLUSTER
              value: nacos
            - name: SW_CLUSTER_NACOS_HOST_PORT
              value: 'http://10.157.4.95:8848'
            - name: SW_CLUSTER_NACOS_PASSWORD
              value: nacos
            - name: SW_CLUSTER_NACOS_USERNAME
              value: nacos
            - name: SW_CONFIGURATION
              value: nacos
            - name: SW_CONFIG_NACOS_SERVER_GROUP
              value: skywalking
            - name: SW_CONFIG_NACOS_SERVER_ADDR
              value: 'http://10.157.4.95'
            - name: SW_CONFIG_NACOS_SERVER_PORT
              value: '8848'
            - name: SW_CONFIG_NACOS_USERNAME
              value: nacos
            - name: SW_CONFIG_NACOS_PASSWORD
              value: nacos
            - name: SW_CORE_METRICS_DATA_TTL
              value: '365'
            - name: SW_CORE_RECORD_DATA_TTL
              value: '365'
            - name: SW_SERVICE_NAME
              value: SkyWalking_OAP_Cluster
          image: 'apache/skywalking-oap-server:8.8.1'
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 3
            initialDelaySeconds: 15
            periodSeconds: 20
            successThreshold: 1
            tcpSocket:
              port: 12800
            timeoutSeconds: 1
          name: oap
          ports:
            - containerPort: 11800
              name: grpc
              protocol: TCP
            - containerPort: 12800
              name: rest
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            initialDelaySeconds: 15
            periodSeconds: 20
            successThreshold: 1
            tcpSocket:
              port: 12800
            timeoutSeconds: 1
      dnsPolicy: ClusterFirst
      restartPolicy: Always

service部署

apiVersion: v1
kind: Service
metadata:
  labels:
    app: skywalking
    component: oap
    release: skywalking
  name: skywalking-oap
  namespace: default
spec:
  selector:
    app: skywalking
    component: oap
    release: skywalking
  type: ClusterIP
  ports:
    - name: grpc
      port: 11800
      protocol: TCP
      targetPort: 11800
    - name: rest
      port: 12800
      protocol: TCP
      targetPort: 12800个

在程序中启动客户端

skywalking-java

#以jar命令启动的java服务只需在启动参数中加入以下参数,单机上有多个服务在启动参数中指定对应服务名称,直接启动就行
 java    -javaagent:/home/op/skywalking/agent/skywalking-agent.jar    -Dskywalking.agent.service_name=sit-paas::route                       -Dskywalking.collector.backend_service=172.16.20.76:11800 -jar yourApp.jar

skywalking-npm

npm install --save skywalking-backend-js
const {default: agent} = require('skywalking-backend-js');

agent.start({
  serviceName: 'dev::regulatory-brain-web',
  serviceInstance: 'dev::regulatory-brain-web-service',
  collectorAddress: '10.15.4.91:31590',
});

skywalking-python

from skywalking import agent, config

config.init(collector_address='127.0.0.1:11800', service_name='your awesome service')

agent.start()
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐