Deployment guide

Nacos

Overview

Nacos is an open-source platform for dynamic service discovery, configuration management and service management. It gives microservices a service registry to find and call each other, and a distributed configuration center that pushes application settings at runtime. It also provides built-in health checking.

This guide covers deploying and configuring Nacos on Ubuntu 24.04 on Azure with the SecureAnyCloud Azure Marketplace image. The image is secure by default. Stock Nacos is associated with a well-known nacos / nacos login, but this image has no known bootstrap credential. It generates all secret material uniquely for each VM on first boot.

What you get:

  • Nacos 3.2.3 running standalone under systemd as the unprivileged nacos system user, with the built-in embedded datastore (no external database required)
  • The Nacos server, run by the unprivileged nacos user, exposing its OpenAPI on port 8848 and its gRPC client port on 9848 for SDK clients, with the web console on port 8080
  • Server API and gRPC authentication enabled (nacos.core.auth.enabled=true), so unauthenticated OpenAPI calls are rejected
  • A unique admin password, JWT signing key and server identity generated per VM on first boot, written to /root/nacos-credentials.txt (mode 0600). The stock nacos / nacos login never works, and the embedded datastore ships empty.
  • The web console on :8080, published only through nginx terminating TLS on :443, with HSTS and security headers
  • Port :80 returning a 301 redirect to HTTPS, plus an unauthenticated /healthz endpoint (HTTP 200) for load balancer probes
  • A self-signed TLS certificate regenerated per VM on first boot (Subject Alternative Names include the VM IP, hostname and 127.0.0.1). Replace it with your own CA-signed certificate for production.
  • A built-in self test at /opt/nacos/nacos-selftest.sh that proves authentication is enforced and that the naming registry round trip works
  • An Ubuntu 24.04 LTS base with the latest security patches applied at build time
  • The Azure Linux Agent for cloud integration and SSH key injection
  • 24/7 SecureAnyCloud support with a guaranteed 24 hour response SLA

Prerequisites

  • An Azure subscription with permission to deploy virtual machines
  • An SSH key pair for administrative access to the VM as the azureuser account
  • A network security group (NSG) that allows inbound TCP 443 (HTTPS console) from your operators, 8848 and 9848 (Nacos server API and gRPC) from your application subnets, and 22 (SSH) from your management network only
  • A VM size of Standard_B2s or larger
1

Deploy from the Azure Portal

Locate the Nacos on Ubuntu 24.04 LTS image in the Azure Marketplace and select Create.

Choose your subscription, resource group and region.

Select a VM size (Standard_B2s or larger). Provide your SSH public key for the azureuser account.

On the Networking tab, allow inbound 443 for the console and 8848 and 9848 for your application clients. Restrict 22 to your management network.

Select Review + create. When the VM is running, browse to https://<your-public-ip>/.

2

Deploy from the Azure CLI

Deploy the same image from the Azure CLI. Replace the resource group, location and image URN as needed:

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:nacos-ubuntu-24-04:default:latest
az vm create \
  --resource-group my-nacos-rg \
  --name nacos \
  --image sac1647283583153:nacos-ubuntu-24-04:default:latest \
  --size Standard_B2s \
  --admin-username azureuser \
  --generate-ssh-keys \
  --public-ip-sku Standard
# then open the console and client ports
az vm open-port --resource-group my-nacos-rg --name nacos --port 443 --priority 1001
az vm open-port --resource-group my-nacos-rg --name nacos --port 8848 --priority 1002
az vm open-port --resource-group my-nacos-rg --name nacos --port 9848 --priority 1003
3

Verify the Nacos and nginx services

SSH in as azureuser. Confirm that both services are active. Confirm that the server listens on the OpenAPI port 8848, the gRPC client port 9848 and the console port 8080, and that nginx listens on 443 and 80:

sudo systemctl is-active nacos nginx
ss -tln | grep -E ':8848 |:9848 |:8080 |:443 |:80 '

The first command should print nacos + nginx: active active. The Nacos server is bound on 8848, 9848 and 8080, and nginx is public on 80 and 443.

4

Retrieve the per-VM admin credentials

The admin password, console URL and client server address are generated uniquely for this VM on first boot. They are written to a root-only file. Read them with:

sudo cat /root/nacos-credentials.txt

The NACOS_ADMIN_PASSWORD value is unique to this instance. The stock nacos / nacos login is disabled, so this is the only credential that works.

5

Open the Nacos console

Browse to https://<your-public-ip>/. The certificate is self-signed and generated per VM, so your browser warns about it the first time. Accept the warning, or install your own certificate (see Step 11).

Sign in as nacos with the password from Step 4.

6

Browse the service registry

Open Services, then Service List. The list shows every service instance registered with Nacos, with its group, instance count and health status.

This registry is the core of Nacos service discovery. Applications register here on start up and discover each other through it.

7

Manage configuration

Open Configuration, then Configurations. The page lists the configuration items Nacos is serving. Each item has a Data ID, a group and a format.

Nacos pushes changes to subscribed clients in real time, so applications pick up new configuration without a restart.

Select Detail on a configuration item to view its full content, metadata and history. The content editor shows exactly what subscribed applications receive.

8

Run the built-in authentication self test

The image ships a self test that proves authentication is enforced and that the naming registry round trip works end to end. It confirms three things. An unauthenticated register is rejected. The stock nacos / nacos login is refused. The per-VM admin can register an instance and read it back.

Run it with:

sudo /opt/nacos/nacos-selftest.sh

The expected output reports round-trip OK. This confirms that authentication is enforced and that the registry works.

9

Prove authentication is enforced and register a service through the API

Server API authentication is enabled, so an unauthenticated call is rejected with 403. Log in with the per-VM admin to obtain an access token. Then use the token to register a service instance and read it back.

Run the whole block in one session so the access token is available to the register and list calls:

PW=$(sudo grep -m1 '^NACOS_ADMIN_PASSWORD=' /root/nacos-credentials.txt | cut -d= -f2-)
TOKEN=$(curl -s -X POST 'http://127.0.0.1:8848/nacos/v3/auth/user/login' \
  --data-urlencode 'username=nacos' --data-urlencode "password=$PW" \
  | python3 -c 'import sys,json; print(json.load(sys.stdin)["accessToken"])')
echo "obtained access token: ${TOKEN:0:24}..." curl -s -X POST "http://127.0.0.1:8848/nacos/v3/admin/ns/instance?accessToken=$TOKEN" \
  --data-urlencode 'serviceName=demo-service' --data-urlencode 'groupName=DEFAULT_GROUP' \
  --data-urlencode 'ip=10.0.0.10' --data-urlencode 'port=8080'
echo curl -s "http://127.0.0.1:8848/nacos/v3/admin/ns/instance/list?serviceName=demo-service&groupName=DEFAULT_GROUP&accessToken=$TOKEN"

The register call returns "data":"ok". The list call returns the instance you just registered.

10

Connect an application

Point your application's Nacos client at this VM. Use the server address for the OpenAPI. The client uses the gRPC client port for real-time discovery and configuration push.

For authentication, use the per-VM admin credential or a dedicated user that you create in the console under the users section. Authentication is enabled on this image, so every client must supply credentials.

For a Spring Cloud Alibaba application, set the server address <your-ip>:8848 and the username and password.

11

Use your own domain and a trusted certificate (production)

The image ships a self-signed certificate so the console is encrypted out of the box, but browsers warn about it. For production, point a DNS name at the VM and install a CA-signed certificate.

Inspect the current per-VM certificate with:

sudo openssl x509 -in /etc/nginx/tls/nacos.crt -noout -subject -ext subjectAltName

With your own domain, obtain a free certificate from Let's Encrypt:

sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d <your-domain>

Certbot installs the certificate into nginx and sets up automatic renewal.

12

How the appliance is wired

Nacos server: nacos.service runs as the unprivileged nacos user from /opt/nacos. It runs in standalone mode with the embedded datastore. It exposes the OpenAPI on 8848 and the gRPC client port on 9848. The heap is sized for a Standard_B2s VM.

Console: the Nacos web console runs on 127.0.0.1:8080. It is published to the network only through nginx.

nginx: nginx.service terminates TLS on :443 and reverse proxies to the console. It redirects :80 to HTTPS. It also serves an unauthenticated /healthz for load balancer probes.

First boot: nacos-firstboot.service runs once on first boot. It does the following:

  • Generates the per-VM JWT signing key, server identity and admin password, and renders them into the configuration
  • Starts Nacos and initialises the admin user
  • Proves the authentication round trip
  • Regenerates the per-VM TLS certificate
  • Writes /root/nacos-credentials.txt

The nacos.service unit is gated, so it can never start before the per-VM secrets are rendered.

13

Managing the Nacos service

sudo systemctl restart nacos
sudo journalctl -u nacos.service --no-pager | tail -20

Server settings live in /opt/nacos/conf/application.properties. After you change a setting, run sudo systemctl restart nacos.

14

Security recommendations

  • Restrict SSH. Allow inbound 22 only from your management network.
  • Scope the client ports. Open 8848 and 9848 only to the application subnets that need service discovery and configuration. Keep the 443 console open to your operators.
  • Install a trusted certificate. Replace the self-signed certificate with a CA-signed one (Step 11), so operators are not trained to click through warnings.
  • Create per-application users. In the console, add a dedicated user and role for each application instead of sharing the admin credential. Keep the admin password safe.
  • Keep the image updated. Unattended security upgrades remain enabled, so the OS keeps receiving patches.
15

Support and Licensing

Nacos is open-source software distributed under the Apache License 2.0. This image bundles the upstream Nacos 3.2.3 release. The license file is retained on the image under /opt/nacos/. SecureAnyCloud provides the packaging, hardening and support.

Deploy on Azure

Find this image on the Azure Marketplace and deploy it in minutes. See secureanycloud.com for the full catalog.

Need Help?

SecureAnyCloud provides 24/7 support with a guaranteed 24 hour response SLA. Contact us through secureanycloud.com for deployment assistance, configuration help or questions about this image.

Deploy on Azure

Launch Nacos on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure