启动ruoyi-auth
1. 需要修改模块的bootstrap.yaml文件中的nacos连接地址为k8s地址
2.进入若依项目建立本地镜像
进入若依的目录:Ruoyi/docker
执行命令: docker compose build ruoyi-auth
3.在nacos中查看服务是否部署成功。
4.ruoyi-auth.yaml内容:
apiVersion: apps/v1
kind: Deployment
metadata:
name: ruoyi-auth
labels:
app: ruoyi-auth
spec:
strategy:
type: Recreate
selector:
matchLabels:
app: ruoyi-auth
template:
metadata:
labels:
app: ruoyi-auth
spec:
containers:
- name: ruoyi-auth
image:docker-ruoyi-auth
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9200
---
kind: Service
apiVersion: v1
metadata:
name: ruoyi-auth
spec:
type: ClusterIP
selector:
app: ruoyi-auth
ports:
- port: 9200
targetPort: 8080
标红的字体为需要根据情况进行修改的镜像名称。
使用minikube image load可以加载本地镜像
5.kubectl apply -f auth.yaml 部署到minikube通过dashboard查看pod