Skip to content

Backstage developer portal on Kubernetes

Deploy Spotify's Backstage developer portal on Kubernetes — software catalogue, TechDocs, scaffolder templates, plugin ecosystem, and authentication.

You have a platform team and your developers are pinging you about “where is the service?”, “who owns this repo?”, “how do I scaffold a new microservice?”, “where are the docs?”. An internal developer portal centralises the answers. Backstage is the open-source one (originally from Spotify, donated to the CNCF) and pairs naturally with a Kubernetes-running platform. This article is the operating procedure we follow on real deployments: build a custom image (Backstage is a code framework, not a packaged app), deploy on Kubernetes, wire authentication, populate the catalogue, ship TechDocs and scaffolder.

How to verify

Backstage runs as a Deployment in its own namespace:

kubectl -n backstage get pods
kubectl -n backstage get svc,ingress

The catalogue should be reachable and authenticated:

curl -sk https://backstage.example.com/api/catalog/entities | jq '.[].kind' | sort -u

Postgres (the metadata DB) should be Running:

kubectl -n backstage get pods -l app=postgresql

A TechDocs build should produce a static site for an entity:

kubectl -n backstage exec -it deploy/backstage -- ls /tmp/techdocs-publisher

What’s happening

Backstage is not a pre-built application. It’s a Node.js + React framework you fork and assemble. The official npx @backstage/create-app scaffolds a monorepo with the core (catalog, scaffolder, techdocs, search, auth) and you add plugins (Kubernetes, ArgoCD, Grafana, GitHub Actions, PagerDuty, custom). You build that into a container image and deploy it.

The platform side: Backstage stores entity metadata in Postgres, fetches catalogue entries (Components, APIs, Resources, Systems, Domains, Users, Groups) from catalog-info.yaml files committed across your repos, indexes them, and shows them in the UI. The Scaffolder uses templates (also in Git) to create new repos / services from a form-driven UI. TechDocs is markdown-in-Git rendered into the portal, with mkdocs.yaml + markdown files alongside the code. Plugins add views — Kubernetes plugin shows pods and deployments per entity, GitHub plugin shows PR/CI status, ArgoCD plugin shows sync state.

The decision points: how often the catalogue refreshes, where TechDocs builds happen (in-cluster or in CI then S3), and which authentication provider feeds the IdP.

The procedure

  1. Bootstrap the app from the official template in your gitops repo:

    npx @backstage/create-app@latest --path backstage
    cd backstage
    yarn install
    yarn dev

    Run it locally to confirm. Commit to a private repo — Backstage IS your code.

  2. Configure for production in app-config.production.yaml:

    app:
      baseUrl: https://backstage.example.com
    backend:
      baseUrl: https://backstage.example.com
      listen: ':7007'
      database:
        client: pg
        connection:
          host: ${POSTGRES_HOST}
          port: 5432
          user: ${POSTGRES_USER}
          password: ${POSTGRES_PASSWORD}
          database: backstage
    auth:
      environment: production
      providers:
        oidc:
          production:
            metadataUrl: https://auth.example.com/.well-known/openid-configuration
            clientId: ${OIDC_CLIENT_ID}
            clientSecret: ${OIDC_CLIENT_SECRET}
            prompt: auto
    catalog:
      locations:
        - type: url
          target: https://github.com/example/gitops/blob/main/catalog/all.yaml
      providers:
        githubOrg:
          default:
            id: github
            orgUrl: https://github.com/example-org
    integrations:
      github:
        - host: github.com
          apps:
            - $include: github-app-credentials.yaml
    techdocs:
      builder: 'local'
      publisher:
        type: 'awsS3'
        awsS3:
          bucketName: backstage-techdocs
          region: us-east-1
  3. Build the container image. Backstage ships a Dockerfile that builds a small Node image:

    yarn install --frozen-lockfile
    yarn tsc
    yarn build:backend --config app-config.yaml --config app-config.production.yaml
    
    docker build . -f packages/backend/Dockerfile \
      -t registry.example.com/backstage:$(git rev-parse --short HEAD)
    docker push registry.example.com/backstage:$(git rev-parse --short HEAD)
  4. Deploy to Kubernetes. Use the Helm chart maintained by the community:

    helm repo add backstage https://backstage.github.io/charts
    helm upgrade --install backstage backstage/backstage \
      --namespace backstage \
      --create-namespace \
      -f backstage-values.yaml

    With backstage-values.yaml referencing your image, ingress, and Secrets:

    backstage:
      image:
        registry: registry.example.com
        repository: backstage
        tag: '1.0.0'
      command: ['node']
      args: ['packages/backend', '--config', 'app-config.yaml', '--config', 'app-config.production.yaml']
    ingress:
      enabled: true
      host: backstage.example.com
      tls:
        enabled: true
    postgresql:
      enabled: true
      auth:
        database: backstage
  5. Populate the catalogue. Create a top-level catalog/all.yaml in your gitops repo that points at every catalog-info.yaml across your service repos:

    apiVersion: backstage.io/v1alpha1
    kind: Location
    metadata:
      name: all-services
    spec:
      targets:
        - https://github.com/example/checkout/blob/main/catalog-info.yaml
        - https://github.com/example/payments/blob/main/catalog-info.yaml

    Each service ships a catalog-info.yaml:

    apiVersion: backstage.io/v1alpha1
    kind: Component
    metadata:
      name: checkout
      description: Checkout API
      annotations:
        github.com/project-slug: example/checkout
        backstage.io/techdocs-ref: dir:.
        argocd/app-name: checkout
    spec:
      type: service
      lifecycle: production
      owner: team-orders
      system: ecommerce
  6. Ship a scaffolder template. A template lets devs create a new service via the UI:

    apiVersion: scaffolder.backstage.io/v1beta3
    kind: Template
    metadata:
      name: nodejs-microservice
    spec:
      type: service
      parameters:
        - title: Service name
          required: [name]
          properties:
            name: { type: string, pattern: '^[a-z][a-z0-9-]+$' }
      steps:
        - id: fetch
          action: fetch:template
          input:
            url: ./skeleton
            values: { name: '${{ parameters.name }}' }
        - id: publish
          action: publish:github
          input:
            repoUrl: github.com?owner=example&repo=${{ parameters.name }}
        - id: register
          action: catalog:register
          input:
            repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}
            catalogInfoPath: '/catalog-info.yaml'

Operational notes

  • Backstage is code. Every plugin you add is yarn add @backstage/plugin-X + a wiring file in packages/app. Treat it like any other JS app — pin versions, dependabot, security review.
  • TechDocs build can OOM if done in-process for large monorepos. Use the local builder for small teams; for >50 services, move the build to CI (GitHub Actions, Tekton) and have Backstage only serve from S3.
  • Postgres for Backstage is small but critical. It holds the catalogue index and search state. Back it up, run with wal_level=replica for PITR, and don’t share it with another workload.
  • OIDC group claims drive ownership. A service with owner: team-orders only renders correctly if the IdP group team-orders exists and members are in it. Mismatches surface as “unknown owner” — pre-load groups before launch.
  • Plugin sprawl is real. Backstage has hundreds of community plugins. Pick five core ones (Kubernetes, Catalog, TechDocs, ArgoCD, GitHub) for v1; everything else when there is a clear need.

Stack Harbor stands up Backstage for clients building an internal developer platform — the Backstage app maintained in their gitops repo, our recommended plugin set, the catalogue conventions, and the OIDC integration with the customer IdP. See how we deliver that alongside managed Kubernetes operations.