165 lines
4.2 KiB
YAML
165 lines
4.2 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: nacos-headless
|
|
labels:
|
|
app: nacos-headless
|
|
spec:
|
|
type: ClusterIP
|
|
clusterIP: None
|
|
ports:
|
|
- port: 8848
|
|
name: server
|
|
targetPort: 8848
|
|
- port: 9848
|
|
name: client-rpc
|
|
targetPort: 9848
|
|
- port: 9849
|
|
name: raft-rpc
|
|
targetPort: 9849
|
|
## 兼容1.4.x版本的选举端口
|
|
- port: 7848
|
|
name: old-raft-rpc
|
|
targetPort: 7848
|
|
selector:
|
|
app: nacos
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: nacos
|
|
labels:
|
|
app: nacos
|
|
spec:
|
|
type: NodePort
|
|
ports:
|
|
- port: 8848
|
|
name: server
|
|
targetPort: 8848
|
|
nodePort: 30020
|
|
- port: 9848
|
|
name: client-rpc
|
|
targetPort: 9848
|
|
- port: 9849
|
|
name: raft-rpc
|
|
targetPort: 9849
|
|
## 兼容1.4.x版本的选举端口
|
|
- port: 7848
|
|
name: old-raft-rpc
|
|
targetPort: 7848
|
|
selector:
|
|
app: nacos
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: nacos-cm
|
|
data:
|
|
mysql.db.name: "nacos"
|
|
mysql.host: "mysql-cluster-mysql-master"
|
|
mysql.port: "3306"
|
|
mysql.user: "greatwall"
|
|
mysql.password: "Greatwall8888"
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: nacos
|
|
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
|
|
topologyKey: "kubernetes.io/hostname"
|
|
containers:
|
|
- name: k8snacos
|
|
imagePullPolicy: IfNotPresent
|
|
image: dev-docker-registry.ccyunchina.com/toyangdon/nacos-server:2.0.3
|
|
resources:
|
|
requests:
|
|
memory: "1Gi"
|
|
cpu: "500m"
|
|
ports:
|
|
- containerPort: 8848
|
|
name: client
|
|
- containerPort: 9848
|
|
name: client-rpc
|
|
- containerPort: 9849
|
|
name: raft-rpc
|
|
- containerPort: 7848
|
|
name: old-raft-rpc
|
|
livenessProbe:
|
|
failureThreshold: 3
|
|
httpGet:
|
|
path: /nacos/v1/console/server/state
|
|
port: 8848
|
|
scheme: HTTP
|
|
initialDelaySeconds: 100
|
|
periodSeconds: 10
|
|
successThreshold: 1
|
|
timeoutSeconds: 1
|
|
readinessProbe:
|
|
failureThreshold: 3
|
|
httpGet:
|
|
path: /nacos/v1/console/server/state
|
|
port: 8848
|
|
scheme: HTTP
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
successThreshold: 1
|
|
timeoutSeconds: 1
|
|
env:
|
|
- name: NACOS_REPLICAS
|
|
value: "3"
|
|
- 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: MYSQL_SERVICE_HOST
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: nacos-cm
|
|
key: mysql.host
|
|
- name: NACOS_SERVER_PORT
|
|
value: "8848"
|
|
- name: NACOS_APPLICATION_PORT
|
|
value: "8848"
|
|
- name: PREFER_HOST_MODE
|
|
value: "hostname"
|
|
- name: NACOS_SERVERS
|
|
value: "nacos-0.nacos-headless.pumpkin-uat.svc.cluster.local.:8848 nacos-1.nacos-headless.pumpkin-uat.svc.cluster.local.:8848 nacos-2.nacos-headless.pumpkin-uat.svc.cluster.local.:8848"
|
|
selector:
|
|
matchLabels:
|
|
app: nacos
|