参考链接

https://blog.51cto.com/saynaihe/2774368
https://github.com/foxiswho/docker-sentinel

拷贝

https://github.com/foxiswho/docker-sentinel 下载并修改Dockerfile,https://github.com/alibaba/Sentinel/releases/tag/1.8.4 下载安装包,改名字为sentinel-dashboard.jar

修改Dockerfile里的版本号
修改Dockerfile

开始build镜像

docker build . -t  xxxxx/sentinel:1.8.4
docker push   xxxxx/sentinel:1.8.4

部署sentinel

vi sentinel-pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sentinel-pvc
  namespace: springcloud
spec:
  storageClassName: rook-cephfs
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi

vi sentinel-stateful.yaml

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: sentinel
  namespace: springcloud
  labels:
    app: sentinel
spec:
  serviceName: sentinel
  replicas: 1
  selector:
    matchLabels:
      app: sentinel
  template:
    metadata:
      labels:
        app: sentinel
    spec:
      imagePullSecrets:
        - name: ksyunregistrykey
      containers:
        - name: sentinel
          image: www.quest-harbor.com/gulimall/sentinel:1.8.4
          imagePullPolicy: IfNotPresent
          resources:
            limits:
              cpu: 4000m
              memory: 8G
            requests:
              cpu: 400m
              memory: 1024Mi
          env:
            - name: TZ
              value: Asia/Shanghai
            - name: JAVA_OPT_EXT
              value: "-Dserver.servlet.session.timeout=7200"
          ports:
            - containerPort: 8280
            - containerPort: 8719
          volumeMounts:
            - name: vol-log
              mountPath: /opt/logs
      volumes:
        - name: vol-log
          persistentVolumeClaim:
            claimName: sentinel-pvc
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: sentinel
  name: sentinel
  namespace: springcloud

spec:
  type: NodePort
  ports:
  - name: "8280"
    port: 8280
    targetPort: 8280
  - name: "8719"
    port: 8719
    targetPort: 8719
  selector:
    app: sentinel

访问sentinel

在这里插入图片描述
在这里插入图片描述

经验证,可以成功部署使用。

Logo

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

更多推荐