• tony徐老师的防脱固发秘籍都被你找到了,快来这里关注我吧。 QQ群
  • tony徐老师的github宝典演示地址
  • github求starhttps://github.com/xuzhijvn
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏tony徐老师吧

k8s:部署sentinel-dashboard

云原生 admin 4个月前 (12-02) 142次浏览 已收录 0个评论 扫描二维码
文章目录[隐藏]

1. 构建镜像

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

2. 创建headless service

apiVersion: v1
kind: Service
metadata:
  name: sentinel-headless
  labels:
    app: sentinel
  annotations:
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
  ports:
    - port: 8718
      name: server
      targetPort: 8718
  clusterIP: None
  selector:
    app: sentinel

3. 创建StatefulSet

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: ccr.ccs.tencentyun.com/xuzhijun/sentinel-dashboard:latest
          resources:
            requests:
              memory: "512Mi"
              cpu: "200m"
          ports:
            - containerPort: 8719
              name: client
          env:
            - name: TZ
              value: Asia/Shanghai
            - name: JAVA_OPTS
              value: "-Dserver.port=8718 -Dcsp.sentinel.dashboard.server=localhost:8718 -Dproject.name=sentinel-dashboard -Djava.security.egd=file:/dev/./urandom -Dcsp.sentinel.api.port=8719"
      imagePullSecrets:
      - name: registry-secret-tencent
  selector:
    matchLabels:
      app: sentinel

4. 通过Ingress暴露服务

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress-yshopcloud
  annotations:
    kubernetes.io/ingress.class: "nginx"
    # 开启use-regex,启用path的正则匹配
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  rules:
    # 定义域名
    - host: sentinel.6and.ltd
      http:
        paths:
        # 不同path转发到不同端口
          - path: /
            backend:
              serviceName: sentinel-headless
              servicePort: 8718

 


万水千山总是情,请小编喝杯咖啡行不行?

写作不易,望支持!!!

XZJ(须知君) , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:k8s:部署sentinel-dashboard
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址