美文网首页云原生
M1系统-k8s-中间件部署-Nacos集群+MySQL+Ing

M1系统-k8s-中间件部署-Nacos集群+MySQL+Ing

作者: 紫荆秋雪_文 | 来源:发表于2023-06-13 18:01 被阅读0次

一、问题

由于我的是Mac M1系统(虚拟机 Linux),直接使用 `nacos/nacos-server:v2.2.3` 镜像安装不成功,搞了我几天,
都开始怀疑自己了。M1系统(虚拟机 Linux)需要使用带有`slim`的镜像 如:`nacos/nacos-server:v2.2.3-slim`

二、挂载文件

cluster.conf

nacos-0.nacos-server.default.svc.cluster.local:8848
nacos-1.nacos-server.default.svc.cluster.local:8848
nacos-2.nacos-server.default.svc.cluster.local:8848

application.properties

#*************** Spring Boot Related Configurations ***************#
### Default web context path:
server.servlet.contextPath=/nacos
### Include message field
server.error.include-message=ALWAYS
### Default web server port:
server.port=8848

spring.datasource.platform=mysql
### Count of DB:
db.num=1
### Connect URL of DB:
db.jdbcDriverName=com.mysql.cj.jdbc.Driver
db.url.0=jdbc:mysql://192.168.199.100:30007/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=raven1991

### Connection pool configuration: hikariCP
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2

### Metrics for elastic search
management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200

### Metrics for influx
management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true

#*************** Access Log Related Configurations ***************#
### If turn on the access log:
server.tomcat.accesslog.enabled=true

### The access log pattern:
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i

### The directory of access log:
server.tomcat.basedir=file:.

#*************** Access Control Related Configurations ***************#
### If enable spring security, this option is deprecated in 1.2.0:
#spring.security.enabled=false

### The ignore urls of auth
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**

### The auth system to use, currently only 'nacos' and 'ldap' is supported:
nacos.core.auth.system.type=nacos

### If turn on auth system:
nacos.core.auth.enabled=true

### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
nacos.core.auth.caching.enabled=true

### Since 1.4.1, Turn on/off white auth for user-agent: nacos-server, only for upgrade from old version.
nacos.core.auth.enable.userAgentAuthWhite=false

### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
### The two properties is the white list for auth and used by identity the request from other server.
nacos.core.auth.server.identity.key=raven
nacos.core.auth.server.identity.value=raven

### worked when nacos.core.auth.system.type=nacos
### The token expiration in seconds:
nacos.core.auth.plugin.nacos.token.cache.enable=false
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
### The default token (Base64 String):
nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789

nacos.istio.mcp.server.enabled=false

三、kuboard 部署 Nacos

image.png image.png image.png image.png image.png

四、使用 Ingress 访问

  • 默认 Ingress-controller 会监听80端口和443端口
  • 需要扩展 Ingress-controller 监听 8848 端口 和 9848 端口

ConfigMap 配置扩展端口

apiVersion: v1
data:
  '8848': 'default/nacos:8848'
  '9848': 'default/nacos:9848'
  '9849': 'default/nacos:9849'
kind: ConfigMap
metadata:
  name: tcp-services
  namespace: ingress-nginx
  resourceVersion: '40342441'
image.png image.png image.png

五、最终效果 image.png

image.png

相关文章

网友评论

    本文标题:M1系统-k8s-中间件部署-Nacos集群+MySQL+Ing

    本文链接:https://www.haomeiwen.com/subject/whkcydtx.html