「NACOS」- 安装 | 部署 | Kubernetes

部署方式

on Kubernetes | with Manifest | ARM64

# 06/13/2025 在 Helm Chart 中,其提供的 YAML 中的部分镜像无 ARM64 架构,所以需要该部署方式。

依赖 https://hub.docker.com/r/nacos/nacos-peer-finder-plugin/tags 镜像,该镜像暂无 linxu/arm64 架构 06/13/2025

通过 YAML 配置,快速部署 https://raw.githubusercontent.com/nacos-group/nacos-k8s/refs/heads/master/deploy/nacos/nacos-quick-start.yaml

on Kubernetes | with Manifest | 废弃

GitHub – alibaba/nacos
Nacos_配置 MySQL 数据库实现持久化

参考 nacos-k8s/README.md at master · nacos-group/nacos-k8s · GitHub 页面(官方文档落后与仓库版本)

第一步、部署存储服务

  • 在集群中,我们部署存储类,所以后面的资源文件也和这个存储类有关,比如名为 nas-client-provisioner 的 StorageClass 将被使用。
  • Kubernetes 存储已经超过该笔记讨论的内容,所以部署这里不再记录。

第二步、部署 MySQL 服务

第三步、部署 Nacos 服务

第四步、访问验证

补充说明

常见问题

用户名密码无效

Nacos 1.4.5 登陆无效,但是 Nacos 1.4.0 能够登录成功。

分析

caused: The specified key byte array is 0 bits which is not secure enough for any JWT HMAC-SHA algorithm. The JWT JWA Specification (RFC 7518, Section 3.2) states that keys used with HMAC-SHA algorithms MUST have a size >= 256 bits (the key size must be greater than or equal to the hash output size). Consider using the io.jsonwebtoken.security.Keys#secretKeyFor(SignatureAlgorithm) method to create a key guaranteed to be secure enough for your preferred HMAC-SHA algorithm. See https://tools.ietf.org/html/rfc7518#section-3.2 for more information.;

通过 DeepSeek 提问,其描述错误是因为 Nacos 1.4 在 JWT (JSON Web Token) 认证时使用了不安全的密钥。那么根据以往经验,需要配置相关环境变量。

方案

添加 NACOS_AUTH_TOKEN 环境变量,取值为 Base64 编码。