sentinel-dashboard下载页面:https://github.com/alibaba/Sentinel/releases

-----------------------------Dockerfile:

FROM openjdk:8-jdk-alpine
VOLUME /tmp
ADD sentinel-dashboard-1.7.1.jar sentinel-dashboard.jar
CMD java ${JAVA_OPTS} -jar sentinel-dashboard.jar
EXPOSE 8080

--------------------------------------------制作image

docker build -t hub.redblue-ai.com/sentinel-dashboard  .

------------------------------------docker-compose 测试:

version: '3'
services:
  sentinel:
    image: hub.redblue-ai.com/sentinel-dashboard
    container_name: sentinel
    restart: on-failure
#    build:
#      context: .
#      dockerfile: Dockerfile
    ports:
      - "8718:8080"
    environment:
      - JAVA_OPTS=-Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -Djava.security.egd=file:/dev/./urandom -Dcsp.sentinel.api.port=8719

 

----------------------------k8s部署

cat <<'END' > sentinel.yaml
---
apiVersion: v1
kind: Service
metadata:
  name: sentinel
  labels:
    app: sentinel
  annotations:
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
  ports:
    - port: 8080
      name: server
      targetPort: 8080
  clusterIP: None
  selector:
    app: sentinel
---
# 外部访问服务
apiVersion: v1
kind: Service
metadata:
  name: sentinel-svc
  labels:
    app: sentinel
spec:
  ports:
  - name: http
    protocol: "TCP"
    port: 8080
    targetPort: 8080
    nodePort: 31808
  type: NodePort
  selector:
    app: sentinel
END
kubectl apply -f sentinel.yaml

cat <<'END' > sentinel-statefulset.yaml
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: sentinel
spec:
  serviceName: sentinel
  replicas: 1
  template:
    metadata:
      labels:
        app: sentinel
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
    spec:
      containers:
        - name: sentinel
          imagePullPolicy: IfNotPresent
          image: hub.redblue-ai.com/sentinel-dashboard:latest
          resources:
            requests:
              memory: "512Mi"
              cpu: "200m"
          ports:
            - containerPort: 8080
              name: client
          env:
            - name: TZ
              value: Asia/Shanghai
            - name: JAVA_OPTS
              value: "-Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -Djava.security.egd=file:/dev/./urandom -Dcsp.sentinel.api.port=8719"
  selector:
    matchLabels:
      app: sentinel
END
kubectl apply -f sentinel-statefulset.yaml

Logo

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

更多推荐