This commit is contained in:
parent
3ad9a6c2da
commit
16d226bd52
|
|
@ -0,0 +1,66 @@
|
||||||
|
# Nacos 安装配置
|
||||||
|
|
||||||
|
## 文件说明
|
||||||
|
|
||||||
|
- `nacos-deployment.yaml` - Nacos 部署配置
|
||||||
|
- `nacos-service.yaml` - Nacos 服务配置
|
||||||
|
- `nacos-ingress.yaml` - Nacos 入口配置
|
||||||
|
- `install-nacos.sh` - 一键安装脚本
|
||||||
|
|
||||||
|
## 快速安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd newinstall/nacos
|
||||||
|
./install-nacos.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## 手动安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -f nacos-deployment.yaml
|
||||||
|
kubectl apply -f nacos-service.yaml
|
||||||
|
kubectl apply -f nacos-ingress.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## 访问地址
|
||||||
|
|
||||||
|
- **Web 控制台**: https://nacos-ops.t-aaron.com
|
||||||
|
- **默认用户名**: nacos
|
||||||
|
- **默认密码**: nacos
|
||||||
|
|
||||||
|
## 配置说明
|
||||||
|
|
||||||
|
### 环境变量
|
||||||
|
|
||||||
|
- `MODE=standalone` - 单机模式
|
||||||
|
- `NACOS_AUTH_TOKEN` - 认证令牌
|
||||||
|
- `NACOS_AUTH_IDENTITY_KEY` - 身份标识键
|
||||||
|
- `NACOS_AUTH_IDENTITY_VALUE` - 身份标识值
|
||||||
|
|
||||||
|
### 端口说明
|
||||||
|
|
||||||
|
- `8080` - HTTP 端口
|
||||||
|
- `8848` - 客户端端口
|
||||||
|
- `9848` - Raft 端口
|
||||||
|
|
||||||
|
### 资源限制
|
||||||
|
|
||||||
|
- **内存请求**: 512Mi
|
||||||
|
- **内存限制**: 1Gi
|
||||||
|
- **CPU 请求**: 250m
|
||||||
|
- **CPU 限制**: 500m
|
||||||
|
|
||||||
|
## 健康检查
|
||||||
|
|
||||||
|
- **存活探针**: `/nacos/v1/console/health/readiness`
|
||||||
|
- **就绪探针**: `/nacos/v1/console/health/readiness`
|
||||||
|
|
||||||
|
## 卸载
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl delete -f nacos-deployment.yaml
|
||||||
|
kubectl delete -f nacos-service.yaml
|
||||||
|
kubectl delete -f nacos-ingress.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
密码改为 tuoheng2023
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "开始安装 Nacos 到 Kubernetes 集群..."
|
||||||
|
|
||||||
|
# 检查 kubectl 是否可用
|
||||||
|
if ! command -v kubectl &> /dev/null; then
|
||||||
|
echo "错误: kubectl 命令未找到,请先安装 kubectl"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 应用 Nacos 配置
|
||||||
|
echo "应用 Nacos Deployment..."
|
||||||
|
kubectl apply -f nacos-deployment.yaml
|
||||||
|
|
||||||
|
echo "应用 Nacos Service..."
|
||||||
|
kubectl apply -f nacos-service.yaml
|
||||||
|
|
||||||
|
echo "应用 Nacos Ingress..."
|
||||||
|
kubectl apply -f nacos-ingress.yaml
|
||||||
|
|
||||||
|
# 等待 Pod 启动
|
||||||
|
echo "等待 Nacos Pod 启动..."
|
||||||
|
kubectl wait --for=condition=ready pod -l app=nacos -n default --timeout=300s
|
||||||
|
|
||||||
|
# 检查状态
|
||||||
|
echo "检查 Nacos 部署状态..."
|
||||||
|
kubectl get pods -l app=nacos -n default
|
||||||
|
kubectl get svc nacos -n default
|
||||||
|
kubectl get ingress nacos-ingress -n default
|
||||||
|
|
||||||
|
echo "Nacos 安装完成!"
|
||||||
|
echo "访问地址: https://nacos-ops.t-aaron.com"
|
||||||
|
echo "默认用户名/密码: nacos/nacos"
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: nacos-standalone
|
||||||
|
namespace: default
|
||||||
|
labels:
|
||||||
|
app: nacos
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nacos
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nacos
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: nacos
|
||||||
|
image: registry.t-aaron.com/nacos/nacos-server:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: http
|
||||||
|
- containerPort: 8848
|
||||||
|
name: client
|
||||||
|
- containerPort: 9848
|
||||||
|
name: raft
|
||||||
|
env:
|
||||||
|
- name: MODE
|
||||||
|
value: "standalone"
|
||||||
|
- name: NACOS_AUTH_TOKEN
|
||||||
|
value: "SecretKey012345678901234567890123456789012345678901234567890123456789"
|
||||||
|
- name: NACOS_AUTH_IDENTITY_KEY
|
||||||
|
value: "nacos"
|
||||||
|
- name: NACOS_AUTH_IDENTITY_VALUE
|
||||||
|
value: "nacos"
|
||||||
|
- name: JVM_XMS
|
||||||
|
value: "512m"
|
||||||
|
- name: JVM_XMX
|
||||||
|
value: "512m"
|
||||||
|
- name: JVM_XMN
|
||||||
|
value: "256m"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "512Mi"
|
||||||
|
cpu: "250m"
|
||||||
|
limits:
|
||||||
|
memory: "1Gi"
|
||||||
|
cpu: "500m"
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /nacos/v1/console/health/readiness
|
||||||
|
port: 8848
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 3
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /nacos/v1/console/health/readiness
|
||||||
|
port: 8848
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 3
|
||||||
|
failureThreshold: 3
|
||||||
|
volumeMounts:
|
||||||
|
- name: nacos-logs
|
||||||
|
mountPath: /home/nacos/logs
|
||||||
|
volumes:
|
||||||
|
- name: nacos-logs
|
||||||
|
emptyDir: {}
|
||||||
|
restartPolicy: Always
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: nacos-ingress
|
||||||
|
namespace: default
|
||||||
|
annotations:
|
||||||
|
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
|
||||||
|
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||||
|
spec:
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- nacos-ops.t-aaron.com
|
||||||
|
secretName: tls
|
||||||
|
rules:
|
||||||
|
- host: nacos-ops.t-aaron.com
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /nacos
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: nacos
|
||||||
|
port:
|
||||||
|
number: 8848
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: nacos
|
||||||
|
namespace: default
|
||||||
|
labels:
|
||||||
|
app: nacos
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 8080
|
||||||
|
targetPort: 8080
|
||||||
|
protocol: TCP
|
||||||
|
- name: client
|
||||||
|
port: 8848
|
||||||
|
targetPort: 8848
|
||||||
|
protocol: TCP
|
||||||
|
- name: raft
|
||||||
|
port: 9848
|
||||||
|
targetPort: 9848
|
||||||
|
protocol: TCP
|
||||||
|
selector:
|
||||||
|
app: nacos
|
||||||
Loading…
Reference in New Issue