阿里云k8s部署Skywalking


1.做镜像

Skywalking-ui:

#Dockerfile
FROM docker.io/apache/skywalking-ui:7.0.0
RUN echo -e http://mirrors.ustc.edu.cn/alpine/v3.7/main/ > /etc/apk/repositories
RUN apk add --no-cache tzdata
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone


#Build
docker build -t  10.0.0.11:5000/skywalking-ui-us:7.0.0 .
docker push 10.0.0.11:5000/skywalking-ui-us:7.0.0

Skywalking-oap:

#Dockerfile
FROM apache/skywalking-oap-server:7.0.0-es7
RUN echo -e http://mirrors.ustc.edu.cn/alpine/v3.7/main/ > /etc/apk/repositories
RUN apk add --no-cache tzdata
ENV Timezone Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$Timezone /etc/localtime && echo '$Timezone' > /etc/timezone


#Build
docker build   -t 10.0.0.11:5000/skywalking-oap-server-us:7.0.0 .
docker push    10.0.0.11:5000/skywalking-oap-server-us:7.0.0
2.yaml文件
#skywalking-oap-server.yaml
---------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: oap
    release: skywalking
  name: skywalking-oap
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: oap
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: oap
        release: skywalking
    spec:
      containers:
        - env:
            - name: JAVA_OPTS
              value: '-Xmx2g -Xms2g'
            - name: SW_CLUSTER
              value: standalone
            - name: SW_STORAGE
              value: elasticsearch7
            - name: SW_STORAGE_ES_CLUSTER_NODES
              value: '10.0.0.11:9200'
          image: >-
            10.0.0.11:5000/skywalking-oap-server-us:7.0.0
          imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 3
            initialDelaySeconds: 15
            periodSeconds: 20
            successThreshold: 1
            tcpSocket:
              port: 12800
            timeoutSeconds: 1
          name: oap
          ports:
            - containerPort: 11800
              protocol: TCP
            - containerPort: 12800
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            initialDelaySeconds: 15
            periodSeconds: 20
            successThreshold: 1
            tcpSocket:
              port: 12800
            timeoutSeconds: 1
          resources:
            limits:
              memory: 2Gi
            requests:
              memory: 1Gi
			  
			  
			  

#skywalking-oap-server-svc.yaml
-------------------------------
apiVersion: v1
kind: Service
metadata:
  name: skywalking-oap-svc
spec:
  clusterIP: 172.20.9.164
  ports:
    - name: rest
      port: 12800
      protocol: TCP
      targetPort: 12800
    - name: grpc
      port: 11800
      protocol: TCP
      targetPort: 11800
  selector:
    app: oap
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}



#skywalking-ui.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: skywalking-ui
  name: skywalking-ui
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: skywalking-ui
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: skywalking-ui
    spec:
      containers:
        - env:
            - name: SW_OAP_ADDRESS
              value: 'skywalking-oap-svc:12800'
          image: >-
            10.0.0.11:5000/skywalking-ui-us:7.0.0
          imagePullPolicy: Always
          name: skywalking-ui
          ports:
            - containerPort: 8080
              name: page
              protocol: TCP
          resources: {}
		  
		  
		  

#skywalking-ui-svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: skywalking-ui-svc
  namespace: default
spec:
  clusterIP: 172.20.9.164
  ports:
    - name: ui
      port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app: skywalking-ui
  type: ClusterIP
status:
  loadBalancer: {}

PS:一定要加探针,否则起来后秒宕!

Logo

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

更多推荐