--- apiVersion: v1 kind: Service metadata: name: nacos namespace: tools labels: app: nacos spec: 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-headless namespace: tools labels: app: nacos spec: publishNotReadyAddresses: true 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 clusterIP: None selector: app: nacos --- apiVersion: apps/v1 kind: StatefulSet metadata: name: nacos namespace: tools spec: podManagementPolicy: Parallel serviceName: nacos-headless replicas: 1 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" # serviceAccountName: cephfs-provisioner initContainers: - name: peer-finder-plugin-install image: registry.cn-hangzhou.aliyuncs.com/zhengyu1992/nacos-peer-finder-plugin:1.1 imagePullPolicy: Always containers: - name: nacos imagePullPolicy: Always image: harbor.haidaifu.net/base/nacos-server:v2.5.1 livenessProbe: httpGet: path: /nacos/# port: 8848 initialDelaySeconds: 60 periodSeconds: 30 timeoutSeconds: 10 failureThreshold: 3 successThreshold: 1 readinessProbe: httpGet: path: /nacos/# port: 8848 initialDelaySeconds: 60 periodSeconds: 30 timeoutSeconds: 10 failureThreshold: 3 successThreshold: 1 resources: requests: memory: "2Gi" cpu: "500m" limits: memory: "4Gi" cpu: "2" ports: - containerPort: 8848 name: client-port - containerPort: 9848 name: client-rpc - containerPort: 9849 name: raft-rpc - containerPort: 7848 name: old-raft-rpc env: - name: PREFER_HOST_MODE value: hostname - name: MODE value: standalone - name: SPRING_DATASOURCE_PLATFORM value: mysql - name: MYSQL_SERVICE_HOST value: "192.168.120.242" - name: MYSQL_SERVICE_PORT value: "3306" - name: MYSQL_SERVICE_USER value: nacos - name: MYSQL_SERVICE_PASSWORD value: mysqlnacos - name: MYSQL_SERVICE_DB_NAME value: nacos - name: MYSQL_SERVICE_DB_PARAM value: "characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true" selector: matchLabels: app: nacos