DevOps & CI/CD Pipelines

Mastering Microservices Deployment

By the Domain India teamPublished 9 min read
Knowledge base article
Contents (10 sections)

Deploying a microservice well means more than getting a container to start. You need a repeatable build, a place to run it, automatic deploys, a database, a way in from the internet and monitoring that tells you when something breaks. This guide is the roadmap for deploying one service, a user authentication service, on your own Linux server with Docker and Kubernetes, and links to the step-by-step guides for each stage.

Key takeaways

Build the service into a Docker image, push it to a registry, and run it on Kubernetes (k3s is the simplest choice on one server) with a Deployment, a Service and an Ingress that gets a free Let's Encrypt certificate. Package it with Helm, deploy it from CI such as GitHub Actions, and add Prometheus and Grafana for monitoring. Rancher is an optional dashboard on top. All of this needs a server with root access, such as a VPS; it can't run on shared hosting.

1. The stack in 2026

The original version of this guide listed a long chain of tools on CentOS. CentOS Linux has reached end of life, and several of those tools overlap. A leaner, current stack:

JobRecommended toolNotes
Server OSAlmaLinux 9, Rocky Linux 9 or Ubuntu 24.04 LTSSupported, current releases
BuildDocker (or Podman)One image per service
Image registryGitHub Container Registry, Docker Hub or your ownYour cluster pulls images from here
Orchestrationk3s (lightweight Kubernetes)A full cluster on one server, grows to several
PackagingHelmOne chart per service, values per environment
CI/CDGitHub Actions, GitLab CI or JenkinsBuild, test, push, deploy on every merge
Ingress and TLSTraefik (included with k3s) or ingress-nginx, plus cert-managerFree Let's Encrypt certificates
DatabasePostgreSQL or MongoDBA managed service or a StatefulSet with backups
MonitoringPrometheus, Grafana, LokiMetrics, dashboards and logs
DashboardRancher (optional)A web UI for clusters

Separate API gateways (Kong) and load balancers (HAProxy) are useful at scale but not needed for your first service: the Ingress controller already routes traffic and balances it across pods. Add a gateway when you have many services that share authentication, rate limits or API keys.

2. Build the service to be deployable

Whatever the language, a service that runs well in containers:

  • reads its settings (database URL, secrets, port) from environment variables;
  • listens on 0.0.0.0 and the port it's told to use;
  • logs to standard output, not to files;
  • exposes a health endpoint, such as /healthz, that returns 200 when it can serve requests;
  • stops cleanly when it receives SIGTERM.

The user authentication service itself is built in Developing the user authentication service.

3. Containerise it with Docker

Write a multi-stage Dockerfile that runs as a non-root user, add a .dockerignore, then build, run and test the image locally:

bash
docker build -t ghcr.io/yourorg/user-service:1.0.0 .
docker run --rm -p 3000:3000 --env-file .env ghcr.io/yourorg/user-service:1.0.0
curl -i http://localhost:3000/healthz
docker push ghcr.io/yourorg/user-service:1.0.0

Tag images with a version or the Git commit, never only latest, so you always know what is running and can roll back. The full walkthrough is Containerising the user service with Docker.

4. Run it on Kubernetes

On a single server, k3s installs a complete, certified Kubernetes in a few minutes. Your service needs three objects: a Deployment (the pods), a Service (a stable internal address) and an Ingress (the public hostname).

A minimal Deployment with health checks and resource limits:

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: user-service
spec:
  replicas: 2
  selector:
    matchLabels: { app: user-service }
  template:
    metadata:
      labels: { app: user-service }
    spec:
      containers:
        - name: user-service
          image: ghcr.io/yourorg/user-service:1.0.0
          ports: [{ containerPort: 3000 }]
          envFrom: [{ secretRef: { name: user-service-env } }]
          readinessProbe:
            httpGet: { path: /healthz, port: 3000 }
          livenessProbe:
            httpGet: { path: /healthz, port: 3000 }
            initialDelaySeconds: 10
          resources:
            requests: { cpu: 100m, memory: 128Mi }
            limits: { memory: 256Mi }

Keep secrets in a Kubernetes Secret (created from your CI or with a tool such as Sealed Secrets or External Secrets), never in the image or the Git repository. The Service, Ingress and rollout commands are in Deploying the user service with Kubernetes.

Two replicas and a readiness probe give you zero-downtime deploys

With at least two replicas, Kubernetes replaces pods one at a time and only sends traffic to a new pod once its readiness probe passes. A bad release stops rolling out instead of taking the service down, and kubectl rollout undo brings back the previous version.

5. Package it with Helm

Once the YAML works, turn it into a Helm chart so the same templates deploy to staging and production with different values (image tag, replicas, hostname, resources):

bash
helm upgrade --install user-service ./charts/user-service \
  --namespace auth --create-namespace \
  --set image.tag=1.0.1

helm rollback user-service returns to the previous release. See Helm charts for beginners.

6. Automate deploys with CI/CD

A pipeline should run on every merge to your main branch:

  1. Test.
    Run the unit and API tests; stop if they fail.
  2. Build and push.
    Build the image, tag it with the commit SHA and push it to the registry.
  3. Deploy.
    Run helm upgrade with the new tag against the cluster, using a kubeconfig stored as a CI secret with only the permissions it needs.
  4. Verify.
    Wait for kubectl rollout status to succeed, then call the health endpoint through the public hostname.

GitHub Actions is the simplest option for code already on GitHub; see GitHub Actions CI/CD to a VPS. Jenkins still works if your team already runs it.

7. The database

An authentication service holds user accounts, so treat its data with care:

  • Managed database: the least work. Your cluster connects to it over TLS.
  • In the cluster: run PostgreSQL or MongoDB as a StatefulSet with a persistent volume, or with an operator. You own backups and upgrades.

Either way, schedule backups, copy them off the server and test a restore. Hash passwords with Argon2 or bcrypt, and never log tokens or passwords. Choosing between PostgreSQL, MySQL, SQLite and MongoDB helps you pick.

8. Monitoring, logs and the Rancher dashboard

Install the Prometheus and Grafana stack (the kube-prometheus-stack Helm chart is the usual route) and expose a /metrics endpoint from your service. Watch request rate, error rate and latency, and alert on them. Add Loki to search logs from every pod in one place. The setup is in Production observability with Prometheus, Grafana and Loki.

Rancher adds a web dashboard for scaling, rolling out and reading logs without kubectl. It is optional and uses extra memory; see Managing the deployment with Rancher.

9. Where to run this on Domain India

Kubernetes, Docker and Rancher need root access and kernel features that shared hosting doesn't allow, so they can't run on cPanel, DirectAdmin or Webuzo plans.

  • VPS: Domain India VPS plans are self-managed KVM servers with full root access. You install and look after the operating system, k3s and your services. A 4 GB plan suits k3s with a few small services; add Rancher and the monitoring stack and choose 8 GB or more.
  • App Platform: if you don't want to run Kubernetes at all, the App Platform builds and runs your service for you. Node.js apps are detected automatically; other languages build from your Dockerfile. It includes PostgreSQL. See Getting started with the App Platform.
VPS Basic
₹1,105.30/mo + GST
  • 2 vCPU
  • 4 GB DDR4 RAM
  • 128 GB NVMe SSD Storage
  • 3 TB Monthly Bandwidth
See plan details
App Developer
₹250/mo + GST
  • 512 MB RAM per app
  • 1.5 GB RAM total
  • 2 vCPU
  • 10 GB NVMe SSD
See plan details

Card prices are Domain India list prices on 19 September 2026, excluding 18% GST.

Frequently asked questions

Do I need Kubernetes to deploy a microservice?

No. A single service can run with Docker Compose on one server, or on a platform that runs containers for you. Kubernetes becomes worth it when you run several services, need rolling updates and self-healing, or plan to add servers.

Is CentOS still a good choice for a new server?

No. CentOS Linux has reached end of life and gets no security updates. Use AlmaLinux 9, Rocky Linux 9 or a current Ubuntu LTS release instead.

What is k3s?

k3s is a lightweight, certified Kubernetes distribution that installs as a single binary. It runs a full cluster on one small server and includes an ingress controller, which makes it a good fit for a VPS.

Do I need Kong and HAProxy for my first microservice?

No. The Kubernetes Ingress controller already routes and load-balances traffic across your pods. Add an API gateway such as Kong when many services need shared authentication, rate limiting or API key management.

Can I run Docker or Kubernetes on Domain India shared hosting?

No. Docker and Kubernetes need root access and kernel features that shared hosting doesn't allow. Use a Domain India VPS, where you install them yourself, or the App Platform, which builds and runs your app for you.

How do I roll back a bad release?

With Helm, run helm rollback with the release name to return to the previous version. Without Helm, kubectl rollout undo on the Deployment does the same. Tagging images by version or commit makes rollbacks predictable.

Ready to deploy your service? Start with containerising it with Docker, then compare VPS plans and the App Platform, or open a support ticket if you're unsure which fits.

Run your own Kubernetes cluster

Domain India VPS plans are self-managed KVM servers with full root access, ready for Docker, k3s and your own services.

See VPS plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app
Microservices Deployment with Docker, k3s and Helm