Sentinel-dashboard安装(k8s部署)
一.拉取镜像并推送到私库
这里选择的是docker hub已经有人制作好的Sentinel镜像
docker pull bladex/sentinel-dashboard:1.8.0
#检查是否拉取成功
docker images | grep bladex/sentinel
#重新给镜像打tag
docker tag bladex/sentinel-dashboard:1.8.0 [你的私人镜像仓库地址]/bladex/sentinel-dashboard:1.8.0
docker pull [你的私人镜像仓库地址]/bladex/sentinel-dashboard:1.8.0
二.准备sentinel statefulset部署配置文件
vi sentinel-statefulset.yaml
#外部web访问服务
apiVersion: v1
kind: Service
metadata:
labels:
app: sentinel
name: sentinel-node
spec:
type: NodePort
ports:
- name: "web"
port: 8858
targetPort: 8858
nodePort: 30280
selector:
app: sentinel
---
# 内部访问服务
apiVersion: v1
kind: Service
metadata:
name: sentinel
labels:
app: sentinel
spec:
type: ClusterIP
ports:
- port: 8858
targetPort: 8858
name: web
- port: 8719
targetPort: 8719
name: api
selector:
app: sentinel
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: sentinel
namespace: default
labels:
app: sentinel
spec:
serviceName: sentinel
replicas: 1
selector:
matchLabels:
app: sentinel
template:
metadata:
labels:
app: sentinel
spec:
containers:
- name: sentinel
image: [镜像地址]/bladex/sentinel-dashboard:1.8.0
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 450m
memory: 1536Mi
requests:
cpu: 400m
memory: 1536Mi
env:
- name: TZ
value: Asia/Shanghai
- name: JAVA_OPT_EXT
value: -Dserver.servlet.session.timeout=7200
- name: SERVER_HOST
value: -Dcsp.sentinel.dashboard.server=sentinel:8858
- name: SERVER_PORT
value: -Dserver.port=8858
- name: SERVER_API
value: -Dcsp.sentinel.api.port=8719
ports:
- containerPort: 8858
- containerPort: 8719
volumeMounts:
- name: vol-log
mountPath: /opt/logs
volumes:
- name: vol-log
persistentVolumeClaim:
claimName: sentinel
imagePullSecrets:
- name: regsecret
因为该配置使用了PVC,所以要新增一个PVC配置文件(此篇文章有搭建NFSStorageClasses 的教程)
vi sentinel-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sentinel
labels:
app: sentinel
spec:
accessModes:
- ReadWriteOnce
storageClassName: "nfs-storage"
resources:
requests:
storage: 10Gi
此处要保证K8s集群已经建立NFS的StorageClasses
三.部署并访问sentinel
#执行pvc的yaml文件
kubectl apply -f sentinel-pvc.yaml
#查看是否创建成功
kubectl get pvc -o wide
#执行statefulset的yml文件
kubectl apply -f sentinel-statefulset.yaml
#检查是否部署成功
kubectl get pod -o wide | grep sentinel
kubectl get services -o wide | grep sentinel
等全部运行好了就通过任意一台k8s主机IP加端口30280访问sentinel,登陆的账号和密码也都是sentinel。当登陆后看到一个初始的sentinel-dashboard项目,部署就成功了。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/199984.html