apiVersion: v1
kind: Service
metadata:
name: nacos-headless
namespace: rz-dt
labels:
app: nacos
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
ports:
- protocol: TCP
port: 8848
name: server
targetPort: 8848
- protocol: TCP
port: 9848
name: client-rpc
targetPort: 9848
- protocol: TCP
port: 9849
name: server-rpc
targetPort: 9849
clusterIP: None
selector:
app: nacos
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nacos
namespace: rz-dt
spec:
serviceName: nacos-headless
replicas: 3
template:
metadata:
labels:
app: nacos
annotations:
pod.alpha.kubernetes.io/initialized: "true"
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- nacos-headless
topologyKey: "kubernetes.io/hostname"
nodeSelector:
rz_dt_nacos_node: rz-dt-nacos
containers:
- name: k8snacos
imagePullPolicy: Always
#v2.1.2可以重启nacos服务自动注册, 2.0.3 重启服务不会自动注册; 对应库nacos_config
image: nacos/nacos-server:v2.1.2
resources:
limits:
cpu: 900m
memory: 2Gi
requests:
cpu: 10m
memory: 50Mi
ports:
- containerPort: 8848
name: client-port
- containerPort: 9848
name: client-grpc
- containerPort: 9849
name: server-grpc
env:
- name: NACOS_REPLICAS
value: "3"
- name: MYSQL_SERVICE_HOST
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.host
- name: MYSQL_SERVICE_DB_NAME
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.db.name
- name: MYSQL_SERVICE_PORT
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.port
- name: MYSQL_SERVICE_USER
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.user
- name: MYSQL_SERVICE_PASSWORD
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.password
- name: MODE
value: "cluster"
- name: NACOS_SERVER_PORT
value: "8848"
- name: PREFER_HOST_MODE
value: "hostname"
- name: NACOS_SERVERS
value: "nacos-0.nacos-headless.rz-dt.svc.cluster.local:8848 nacos-1.nacos-headless.rz-dt.svc.cluster.local:8848 nacos-2.nacos-headless.rz-dt.svc.cluster.local:8848"
selector:
matchLabels:
app: nacos
---
apiVersion: v1
kind: Service
metadata:
name: nacos-service
namespace: rz-dt
annotations:
nginx.ingress.kubernetes.io/affinity: "true"
nginx.ingress.kubernetes.io/session-cookie-name: backend
nginx.ingress.kubernetes.io/load-balancer-method: drr
spec:
selector:
app: nacos
ports:
- name: nacos-headless
protocol: TCP
port: 8848
targetPort: 8848
nodePort: 30048
- name: nacos-rpc
protocol: TCP
port: 9848
targetPort: 9848
nodePort: 31048
- name: nacos-grpc
protocol: TCP
port: 9849
targetPort: 9849
nodePort: 31049
type: NodePort
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nacos-web
namespace: rz-dt
spec:
rules:
- host: nacos.realize.com.cn
http:
paths:
- path: /nacos
backend:
serviceName: nacos-service
servicePort: 8848
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nacos-cm
namespace: rz-dt
data:
mysql.host: "rm-uf6c2o6h7hg0r.mysql.rds.aliyuncs.com"
mysql.db.name: "nacos"
mysql.port: "3306"
mysql.user: "real"
mysql.password: "1234"
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论



























收起资源包目录




















共 15 条
- 1
资源评论


xiaogg3678
- 粉丝: 155
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 520网络情人节祝福语简短一句话.docx
- 计算机专业单片机课程设计要求.docx
- 基于元胞自动机的适应网络病毒传播研究.pptx
- 网络公司第一季度工作总结.pptx
- 网络咨询解答技巧.ppt
- 数据库课程设计机票预订系统.doc
- 信息系统安全等级保护第二级要求技术要求物理安全物理位置选择------.pdf
- 软件工程需求分析.doc
- 2023年计算机二级MSOFFICE模拟考试题及答案题目.doc
- 移动通信试题基础题.doc
- 设备报废申请单(Excel表格通用模板).xlsx
- 数字医学图像处理复习资料.pdf
- 高级语言程序设计.doc
- 互联网公司员工的辞职信.doc
- 东莞大剧院综合布线系统智能化系统项目工程设计文件.doc
- easy-query-SQL资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
